Created
May 26, 2020 00:52
-
-
Save infantiablue/56788fd011658b649b71efd67eea4f09 to your computer and use it in GitHub Desktop.
create customize form template in django - forms
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 ProfileEditForm(forms.ModelForm | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.fields['photo'].widget.template_name = 'core/widgets/photo.html' | |
class Meta: | |
model = Profile | |
fields = ('date_of_birth', 'photo') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment