from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import perfil


class UserForm(UserCreationForm):
    first_name = forms.CharField()
    last_name = forms.CharField()
    

    class Meta:
        model = User
        fields = ('first_name','last_name', 'username', 'email', 'password1' ,'password2' )
        
        
class Formperfil(forms.ModelForm):
    def __init__(self, *args, **kwargs):
       super(Formperfil, self).__init__(*args, **kwargs)
       self.fields['key'].widget.attrs['readonly'] = True
       self.fields["key"].widget = forms.HiddenInput()
       self.fields['usuario'].widget.attrs['readonly'] = True
       self.fields["usuario"].widget = forms.HiddenInput()
       
    class Meta:
        model = perfil
        fields = ('usuario', 'matricula', 'cuatrimestre', 'grupo', 'direccion', 'genero', 'telefono', 'tipo', 'id_carrera', 'foto', 'key')


class FormperfilEnv(forms.ModelForm):
    class Meta:
        model = perfil
        fields = ('matricula', 'cuatrimestre', 'grupo', 'direccion', 'genero', 'telefono', 'tipo', 'id_carrera', 'foto')



