-
Notifications
You must be signed in to change notification settings - Fork 551
Add additional filters to scanner query rules/results #23984
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 additional filters to scanner query rules/results #23984
Conversation
0b71034 to
930bf98
Compare
| """ | ||
|
|
||
| template = 'admin/amo/numeric_range_filter.html' | ||
|
|
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.
When testing the label tags were empty (the label tag existed, but there was no text value). Date range filter fields get "To" and "From" labels; numeric range filter fields did not - though the placeholder texts did say "To" and "From".
Do you need to override _get_form_fields too?
At that point, you probably want to inherit from DateRangeFilter, or a common ancestor - it's worth considering anyway as your choices seems to be a direct copy and paste.
| choices=STATUS_CHOICES.items(), default=amo.STATUS_AWAITING_REVIEW | ||
| ) | ||
| datestatuschanged = models.DateTimeField(null=True, auto_now_add=True) | ||
| datestatuschanged = models.DateTimeField(null=True, default=timezone.now) |
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.
Not saying this is a bad change to make ... but we could just special case datestatuschanged field in file_factory - pop the value and set it after the create, and so avoid any database/model change to prod.
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.
Probably fine
Fixes mozilla/addons#15831
Context
All fairly straightforward - just a couple annoyances:
FieldListFilterwill get theirtitleattribute set in__init__, hence the need for the custom__init__method in the new classes - we already did that for existing filtersrangefilterbrings, so we need a custom template & fake choices, exactly like we already do for the date one (seeamo.admin.DateRangeFilter)Addon.last_updatedis set automatically inaddon_factory(), using the normal code to compute it, which depends onFile.datestatuschanged. That field hadauto_now_addso it couldn't be set by the factory, I had to change it todefault=timezone.nowto allow that.