Created
August 26, 2015 20:22
-
-
Save stephane/40797e271521728921ff to your computer and use it in GitHub Desktop.
How to override the widget of a field in the administration of Django
This file contains 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
class IssueAdminForm(forms.ModelForm): | |
class Meta: | |
model = app_models.Issue | |
fields = ['title', 'labels'] | |
widgets = { | |
'labels': app_forms.ArrayFieldSelectMultiple( | |
choices=app_models.Issue.LABEL_CHOICES), | |
} | |
class IssueAdmin(admin.ModelAdmin): | |
form = IssueAdminForm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment