-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do more filtering in new base views #5580
Conversation
@@ -1112,7 +1112,7 @@ def build_context_menu(self, menu): | |||
) | |||
|
|||
def derive_queryset(self, **kwargs): | |||
return super().derive_queryset(**kwargs).filter(is_active=True, is_system=False) | |||
return super().derive_queryset(**kwargs).filter(is_proxy=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_proxy
for fields means "created_on" etc which are proxies for Contact model attributes
@@ -684,8 +684,7 @@ def get_context_data(self, **kwargs): | |||
return context | |||
|
|||
def derive_queryset(self, *args, **kwargs): | |||
qs = super().derive_queryset(*args, **kwargs) | |||
return qs.exclude(is_system=True).exclude(is_active=False) | |||
return super().derive_queryset(*args, **kwargs).exclude(is_system=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_system
for flows means single message campaign flows for now... these might become broadcasts anyways
|
||
if not self.request.user.is_authenticated: | ||
return qs.none() # pragma: no cover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can't happen.. base list views use OrgPermsMixin so you can't be here if org isn't set
4bec02f
to
8388fee
Compare
…always filter by is_system=False
8388fee
to
820c009
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5580 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 550 550
Lines 25671 25674 +3
=========================================
+ Hits 25671 25674 +3 ☔ View full report in Codecov by Sentry. |
BaseListView
filter byis_active=True
BaseUpdateView
filter byis_active=True
andis_system=False
BaseDeleteView
noop foris_system=True