from django import forms
from .models import Profile
from django.contrib.auth.models import User

class UserRegistrationForm(forms.ModelForm):
    password = forms.CharField(label='Password', widget=forms.PasswordInput)
    password2 = forms.CharField(label='Repeat password', widget=forms.PasswordInput)

    class Meta:
        model = User
        fields = ('username', 'first_name', 'email')

    def clean_password2(self):
        cd = self.cleaned_data
        if cd['password'] != cd['password2']:
            raise forms.ValidationError('Passwords don\'t match.')
        return cd['password2']

class LoginForm(forms.Form):
    username = forms.CharField(
        label='username',
        required=True
    )
    password = forms.CharField(
        label='password',
        required=True,
        widget=forms.HiddenInput
    )

class RegisterForm(forms.ModelForm):  
    class Meta:
        model = Profile
        fields = (
        'user',
        'phone',
        'address',
        'birth_date'
        )
        
        initial = {
            'user': User.username, # This field value will be shown in the form when an unbound form is loaded.
        }
        
cc00e1a3b952b2cf47c43e98e12ef0b34adea840
<mask token>


class LoginForm(forms.Form):
    <mask token>
    <mask token>


class RegisterForm(forms.ModelForm):


    class Meta:
        model = Profile
        fields = 'user', 'phone', 'address', 'birth_date'
        initial = {'user': User.username}

<mask token>


class UserRegistrationForm(forms.ModelForm):
    <mask token>
    <mask token>


    class Meta:
        model = User
        fields = 'username', 'first_name', 'email'

    def clean_password2(self):
        cd = self.cleaned_data
        if cd['password'] != cd['password2']:
            raise forms.ValidationError("Passwords don't match.")
        return cd['password2']


class LoginForm(forms.Form):
    username = forms.CharField(label='username', required=True)
    password = forms.CharField(label='password', required=True, widget=
        forms.HiddenInput)


class RegisterForm(forms.ModelForm):


    class Meta:
        model = Profile
        fields = 'user', 'phone', 'address', 'birth_date'
        initial = {'user': User.username}

<mask token>


class UserRegistrationForm(forms.ModelForm):
    password = forms.CharField(label='Password', widget=forms.PasswordInput)
    password2 = forms.CharField(label='Repeat password', widget=forms.
        PasswordInput)


    class Meta:
        model = User
        fields = 'username', 'first_name', 'email'

    def clean_password2(self):
        cd = self.cleaned_data
        if cd['password'] != cd['password2']:
            raise forms.ValidationError("Passwords don't match.")
        return cd['password2']


class LoginForm(forms.Form):
    username = forms.CharField(label='username', required=True)
    password = forms.CharField(label='password', required=True, widget=
        forms.HiddenInput)


class RegisterForm(forms.ModelForm):


    class Meta:
        model = Profile
        fields = 'user', 'phone', 'address', 'birth_date'
        initial = {'user': User.username}

from django import forms
from .models import Profile
from django.contrib.auth.models import User


class UserRegistrationForm(forms.ModelForm):
    password = forms.CharField(label='Password', widget=forms.PasswordInput)
    password2 = forms.CharField(label='Repeat password', widget=forms.
        PasswordInput)


    class Meta:
        model = User
        fields = 'username', 'first_name', 'email'

    def clean_password2(self):
        cd = self.cleaned_data
        if cd['password'] != cd['password2']:
            raise forms.ValidationError("Passwords don't match.")
        return cd['password2']


class LoginForm(forms.Form):
    username = forms.CharField(label='username', required=True)
    password = forms.CharField(label='password', required=True, widget=
        forms.HiddenInput)


class RegisterForm(forms.ModelForm):


    class Meta:
        model = Profile
        fields = 'user', 'phone', 'address', 'birth_date'
        initial = {'user': User.username}

from django import forms
from .models import Profile
from django.contrib.auth.models import User

class UserRegistrationForm(forms.ModelForm):
    password = forms.CharField(label='Password', widget=forms.PasswordInput)
    password2 = forms.CharField(label='Repeat password', widget=forms.PasswordInput)

    class Meta:
        model = User
        fields = ('username', 'first_name', 'email')

    def clean_password2(self):
        cd = self.cleaned_data
        if cd['password'] != cd['password2']:
            raise forms.ValidationError('Passwords don\'t match.')
        return cd['password2']

class LoginForm(forms.Form):
    username = forms.CharField(
        label='username',
        required=True
    )
    password = forms.CharField(
        label='password',
        required=True,
        widget=forms.HiddenInput
    )

class RegisterForm(forms.ModelForm):  
    class Meta:
        model = Profile
        fields = (
        'user',
        'phone',
        'address',
        'birth_date'
        )
        
        initial = {
            'user': User.username, # This field value will be shown in the form when an unbound form is loaded.
        }
        