kers/users/forms.py

27 lines
782 B
Python
Raw Normal View History

2020-07-22 00:52:02 +02:00
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
2020-07-24 23:33:11 +02:00
from django.forms import ModelForm, TextInput
2020-07-22 00:52:02 +02:00
from .models import CustomUser
class CustomUserCreationForm(UserCreationForm):
class Meta(UserCreationForm):
model = CustomUser
2020-07-22 05:03:01 +02:00
fields = ('username', 'student_number', 'real_name',)
2020-07-22 00:52:02 +02:00
class CustomUserChangeForm(UserChangeForm):
class Meta:
model = CustomUser
2020-07-22 05:03:01 +02:00
fields = ('username', 'student_number', 'real_name',)
2020-07-22 16:06:04 +02:00
class UserMetaForm(ModelForm):
class Meta:
model = CustomUser
2020-07-24 23:33:11 +02:00
fields = ['real_name', 'student_number']
widgets = {
'real_name': TextInput(attrs={'placeholder': 'Robbe Van Herck'}),
'student_number': TextInput(attrs={'placeholder': '001700000'})
}