def get_queryset(self): """ Get the list of items for this view. This must be an iterable, and may be a queryset (in which qs-specific behavior will be enabled). """ user = self.request.user qs = super().get_queryset().only('uuid', 'last_login', 'username', 'first_name', 'last_name', 'date_joined', 'picture', 'valid_until') \ .prefetch_related('useremail_set', 'organisations') qs = user.filter_administrable_app_admin_users(qs) self.cl = main.ChangeList(self.request, self.model, self.list_display, default_ordering=[ OrderByWithNulls(F('last_login'), descending=True) ]) # apply filters qs = UserSearchFilter().apply(self, qs) qs = CountryFilter().apply(self, qs) qs = AdminRegionFilter().apply(self, qs) qs = CenterFilter().apply(self, qs) qs = ApplicationRoleFilter().apply(self, qs) qs = RoleProfileFilter().apply(self, qs) qs = IsActiveFilter().apply(self, qs) # Set ordering. ordering = self.cl.get_ordering(self.request, qs) qs = qs.order_by(*ordering).distinct() return qs
def get_queryset(self): """ Get the list of items for this view. This must be an iterable, and may be a queryset (in which qs-specific behavior will be enabled). """ self.cl = main.ChangeList(self.request, self.model, self.list_display, default_ordering=['order', 'country']) qs = super().get_queryset().select_related('country', 'email') # apply filters qs = MyCountriesFilter().apply(self, qs) qs = CountrySearchFilter().apply(self, qs) qs = AssociationFilter().apply(self, qs) qs = ContinentsFilter().apply(self, qs) qs = CountryGroupFilter().apply(self, qs) if self.request.user.is_organisation_admin: qs = IsActiveFilter().apply(self, qs) else: qs = qs.filter(is_active=True) # Set ordering. ordering = self.cl.get_ordering(self.request, qs) qs = qs.order_by(*ordering) return qs.distinct()
def get_queryset(self): qs = RegistrationProfile.objects.get_not_expired() \ .prefetch_related('user__organisations', 'user__organisations__organisation_country__country', 'user__useraddress_set', 'user__useraddress_set__country', 'user__useremail_set') \ .filter(user__is_active=False, is_validated=True, user__last_login__isnull=True) # display only users from centers where the logged in user has admin rights user = self.request.user qs = RegistrationManager.filter_administrable_registrationprofiles( user, qs) # Set ordering. self.cl = main.ChangeList(self.request, self.model, self.list_display, default_ordering=['-date_registered']) # apply filters qs = RegistrationSearchFilter().apply(self, qs) qs = CountryFilter().apply(self, qs) qs = CheckBackFilter().apply(self, qs) qs = IsAccessDeniedFilter().apply(self, qs) qs = IsStoredPermanentlyFilter().apply(self, qs) ordering = self.cl.get_ordering(self.request, qs) qs = qs.order_by(*ordering) return qs
def get_queryset(self): self.cl = main.ChangeList( self.request, self.model, self.list_display, default_ordering=[OrderByWithNulls(F('order'), descending=True)]) qs = self.request.user.get_administrable_role_profiles() # Set ordering. ordering = self.cl.get_ordering(self.request, qs) qs = qs.order_by(*ordering).distinct() return qs
def get_queryset(self): """ Get the list of items for this view. This must be an iterable, and may be a queryset (in which qs-specific behavior will be enabled). """ qs = super().get_queryset() qs = self.request.user.filter_administrable_apps(qs) self.cl = main.ChangeList(self.request, self.model, self.list_display) # apply filters qs = ApplicationSearchFilter().apply(self, qs) qs = IsActiveFilter().apply(self, qs) # Set ordering. ordering = self.cl.get_ordering(self.request, qs) if ordering: qs = qs.order_by(*ordering) return qs.distinct()
def get_queryset(self): user = self.request.user qs = OrganisationChange.open.all() qs = user.filter_administrable_organisationchanges(qs) self.cl = main.ChangeList(self.request, self.model, self.list_display, default_ordering=['-last_modified']) # apply filters qs = UserSearchFilter2().apply(self, qs) qs = OrganisationChangeCountryFilter().apply(self, qs) qs = OrganisationChangeAdminRegionFilter().apply(self, qs) # Set ordering. ordering = self.cl.get_ordering(self.request, qs) qs = qs.order_by(*ordering).distinct() return qs
def get_queryset(self): """ Get the list of items for this view. This must be an iterable, and may be a queryset (in which qs-specific behavior will be enabled). """ user = self.request.user qs = super().get_queryset().select_related() if not user.has_perms(["emails.change_groupemail"]): qs = qs.filter(Q(email__is_active=True) & (Q(groupemailmanager__manager=user) | Q(email__permission=PERM_EVERYBODY))) self.cl = main.ChangeList(self.request, self.model, self.list_display, default_ordering=['email']) # apply filters qs = MyGroupEmailsFilter().apply(self, qs) qs = EmailSearchFilter().apply(self, qs) qs = PermissionFilter().apply(self, qs) qs = IsActiveFilter().apply(self, qs) # Set ordering. ordering = self.cl.get_ordering(self.request, qs) qs = qs.order_by(*ordering) return qs.distinct()