def formfield_for_manytomany(self, db_field, request, **kwargs):
     if 'subscribers' in db_field.name and not request.user.is_superuser \
            and USE_WORKGROUPS:
         contacts_pk = request_workgroups_contacts_pk(request)
         kwargs['queryset'] = Contact.objects.filter(pk__in=contacts_pk)
     return super(MailingListAdmin, self).formfield_for_manytomany(
         db_field, request, **kwargs)
Example #2
0
 def formfield_for_manytomany(self, db_field, request, **kwargs):
     if 'subscribers' in db_field.name and not request.user.is_superuser:
         contacts_pk = request_workgroups_contacts_pk(request)
         kwargs['queryset'] = Contact.objects.filter(pk__in=contacts_pk)
     return super(MailingListAdmin,
                  self).formfield_for_manytomany(db_field, request,
                                                 **kwargs)
 def formfield_for_manytomany(self, db_field, request, **kwargs):
     if db_field.name == "test_contacts":
         queryset = Contact.objects.filter(tester=True)
         if not request.user.is_superuser:
             contacts_pk = request_workgroups_contacts_pk(request)
             queryset = queryset.filter(pk__in=contacts_pk)
         kwargs["queryset"] = queryset
     return super(NewsletterAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
 def formfield_for_manytomany(self, db_field, request, **kwargs):
     if db_field.name == 'test_contacts':
         queryset = Contact.objects.filter(tester=True)
         if not request.user.is_superuser and USE_WORKGROUPS:
             contacts_pk = request_workgroups_contacts_pk(request)
             queryset = queryset.filter(pk__in=contacts_pk)
         kwargs['queryset'] = queryset
     return super(BaseNewsletterAdmin, self).formfield_for_manytomany(
         db_field, request, **kwargs)
Example #5
0
 def formfield_for_manytomany(self, db_field, request, **kwargs):
     if db_field.name == 'test_contacts':
         queryset = Contact.objects.filter(tester=True)
         if not request.user.is_superuser and USE_WORKGROUPS:
             contacts_pk = request_workgroups_contacts_pk(request)
             queryset = queryset.filter(pk__in=contacts_pk)
         kwargs['queryset'] = queryset
     return super(BaseNewsletterAdmin, self).formfield_for_manytomany(
         db_field, request, **kwargs)
Example #6
0
 def queryset(self, request):
     queryset = super(ContactAdmin, self).queryset(request)
     if not request.user.is_superuser and USE_WORKGROUPS:
         contacts_pk = request_workgroups_contacts_pk(request)
         queryset = queryset.filter(pk__in=contacts_pk)
     return queryset
Example #7
0
 def queryset(self, request):
     queryset = super(ContactAdmin, self).queryset(request)
     if not request.user.is_superuser and USE_WORKGROUPS:
         contacts_pk = request_workgroups_contacts_pk(request)
         queryset = queryset.filter(pk__in=contacts_pk)
     return queryset