Fixes 500 errors when viewing an Organization in the Django Admin#3519
Merged
Fixes 500 errors when viewing an Organization in the Django Admin#3519
Conversation
OpenAPI ChangesShow/hide ## Changes for v0.yaml:Unexpected changes? Ensure your branch is up-to-date with |
rhysyngsun
requested changes
Apr 22, 2026
|
|
||
| return f"UserOrganization: {self.user} in {self.organization}" | ||
|
|
||
| def user_email(self): |
Collaborator
There was a problem hiding this comment.
I think this is a better served with @admin.display (see the third example here), since this is very specific to django-admin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
n/a
Description (What does it do?)
Noticed that the Django Admin consistently returns a 500 when viewing a B2B organization in the Django Admin in production. This hopefully fixes that by prefetching the user and specifically displaying only the user email for the
UserOrganizationAdminInline.This also removes the add/change/delete permission from the inline. If you want to manage admins, you can do that from the individual user's edit screen in the Django Admin.
How can this be tested?
View an organization page in the Django Admin. It should work as expected. Ideally, use an org that has some managers set up in it. You can set that up in the user record.
Additional Context
Assuming this will help - the page takes a while to load and then errors out with a 502, but the Django process doesn't ever fail really so there's no Sentry error pointing to something specific. I can't reproduce this on RC or locally. But, the User model can be pretty unwieldy to load so this seemed like a good place to start.