Skip to content

Instantly share code, notes, and snippets.

@Marceloromeugoncalves
Created October 20, 2021 00:50
Show Gist options
  • Save Marceloromeugoncalves/5d03bc853ddd878fcd45129cad4211d9 to your computer and use it in GitHub Desktop.
Save Marceloromeugoncalves/5d03bc853ddd878fcd45129cad4211d9 to your computer and use it in GitHub Desktop.
Exemplo - Estendendo o UserCreationForm do Django.
#forms.py
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Profile
class UserRegisterForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['username', 'email', 'password1', 'password2']
class UserUpdateForm(forms.ModelForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['username', 'email']
class ProfileUpdateForm(forms.ModelForm):
class Meta:
model = Profile
fields = ['image']
@Marceloromeugoncalves
Copy link
Author

password1 = password
password2 = confirmação do password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment