Skip to content

Instantly share code, notes, and snippets.

@paulwinex
Created July 26, 2018 14:08
Show Gist options
  • Save paulwinex/ae62175fac35f5337a1091a2c7de62e8 to your computer and use it in GitHub Desktop.
Save paulwinex/ae62175fac35f5337a1091a2c7de62e8 to your computer and use it in GitHub Desktop.
def formfield_for_dbfield(self, db_field, **kwargs):
field = super(AuthorAdmin, self).formfield_for_dbfield(db_field, **kwargs)
if db_field.name == 'user':
field.queryset = GenericUser.objects.all().order_by('email')
return field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment