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
Fix/optimization fixes #55
Conversation
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.
looks good!
@@ -77,4 +77,4 @@ class ConfigurationStatusFilter(django_filters.FilterSet): | |||
|
|||
class Meta: | |||
model = ConfigurationStatus | |||
fields = '__all__' | |||
fields = ('guide_camera_name',) |
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.
what about instrument name?
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.
Instrument name is included as a filterable field since it is declared in the filterset a few lines up
@@ -91,10 +91,12 @@ def proposal_title(self, obj): | |||
|
|||
class ProposalInviteAdmin(admin.ModelAdmin): | |||
model = ProposalInvite | |||
raw_id_fields = ['proposal'] |
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.
do raw_id_fields still give you a link to that admin object?
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.
Yep!
The issue with the slow
/api/configurationstatus/
endpoint was its filter. For a filterset, if a field that is a foreign key is included, the default filter that is used is aModelChoiceFilter
, which generates all the options for that field. So it's pretty slow on big tables.The admin target change page was slow for a similar reason. The associated configuration is displayed on the page, and by default django will generate a dropdown with all options so that the user can update the associated configuration. Using
raw_id_fields
helps that.