diff options
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']]) | 
