diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-08-12 16:33:46 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-08-12 16:33:46 +0200 | 
| commit | f58aa8293e992f8a666823f81df8d99af5cd4ef6 (patch) | |
| tree | 446c6aa8ebfcc194a1d7cd14caf77071dac00c97 /ishtar_common/views.py | |
| parent | 03a013faed805d5e4de48f82dd7760805e2eafeb (diff) | |
| download | Ishtar-f58aa8293e992f8a666823f81df8d99af5cd4ef6.tar.bz2 Ishtar-f58aa8293e992f8a666823f81df8d99af5cd4ef6.zip | |
Import - match form: only display 250 first matches
Diffstat (limited to 'ishtar_common/views.py')
| -rw-r--r-- | ishtar_common/views.py | 14 | 
1 files changed, 13 insertions, 1 deletions
| diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 8b4d212a7..f867a03cf 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1606,16 +1606,28 @@ class ImportLinkView(IshtarMixin, LoginRequiredMixin, ModelFormSetView):      }      form_class = forms.TargetKeyForm      formset_class = forms.TargetKeyFormset +    max_fields = 250      def get_formset_kwargs(self):          kwargs = super(ImportLinkView, self).get_formset_kwargs()          kwargs['user'] = self.request.user          return kwargs -    def get_queryset(self): +    def full_queryset(self):          return self.model.objects.filter(              is_set=False, associated_import=self.kwargs['pk']) +    def get_queryset(self): +        return self.full_queryset()[:self.max_fields] + +    def get_context_data(self, **kwargs): +        data = super().get_context_data(**kwargs) +        total = self.full_queryset().count() +        if total > self.max_fields: +            data['MAX_FIELDS_REACHED'] = self.max_fields +            data['TOTAL'] = total +        return data +      def get_success_url(self):          return reverse('import_link_unmatched', args=[self.kwargs['pk']]) | 
