Skip to content

Instantly share code, notes, and snippets.

@infantiablue
Created May 26, 2020 00:52
Show Gist options
  • Save infantiablue/56788fd011658b649b71efd67eea4f09 to your computer and use it in GitHub Desktop.
Save infantiablue/56788fd011658b649b71efd67eea4f09 to your computer and use it in GitHub Desktop.
create customize form template in django - forms
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