-
Notifications
You must be signed in to change notification settings - Fork 537
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
Add BlockType enum to BlockVersion model #22706
Conversation
e94f814
to
ba87c89
Compare
src/olympia/blocklist/models.py
Outdated
_queryset_class = BlockVersionQuerySet | ||
|
||
def soft_blocked(self): | ||
return self.get_queryset().soft_blocked() | ||
|
||
def hard_blocked(self): | ||
return self.get_queryset().hard_blocked() |
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.
You might be able to replace that with just... nothing, and defining objects
below with as_manager()
, like this: objects = BlockVersionQuerySet.as_manager()
.
For more complex cases where you do want the functionalty ManagerBase
brings we can also define an empty manager inheriting from ManagerBase
and use from_queryset()
like this: BlockVersionManager.from_queryset(BlockVersionQuerySet)()
If we have custom methods in the manager that somehow don't belong in the queryset but do call queryset stuff, then it's no longer appropriate, but most of the time that should be enough. We have a bunch of old code using the method you used, but for new cases without anything fancy we should try the modern Django way and avoid repetition.
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 belongs in the docs.
9056990
to
07e91ff
Compare
07e91ff
to
ae267be
Compare
ae267be
to
0212e11
Compare
Relates to: mozilla/addons#15014
Description
TBD
Context
Testing
Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.