Skip to content
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

Merged
merged 2 commits into from Jul 22, 2019
Merged

Fix/optimization fixes #55

merged 2 commits into from Jul 22, 2019

Conversation

eheinrich
Copy link
Member

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 a ModelChoiceFilter, 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.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 96.156% when pulling 7fc6654 on fix/optimization-fixes into 429ae87 on master.

Copy link
Member

@jnation3406 jnation3406 left a 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',)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about instrument name?

Copy link
Member Author

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']
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

@eheinrich eheinrich merged commit 2f5965a into master Jul 22, 2019
@eheinrich eheinrich deleted the fix/optimization-fixes branch July 22, 2019 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants