site_tps/users/forms.py
2018-03-10 14:48:48 +01:00

72 lines
1.4 KiB
Python

from django import forms
from django.contrib.auth.models import User
from .models import School
class CreateSchool(forms.ModelForm):
class Meta:
model = School
fields = ['name', 'admin']
class EditName(forms.ModelForm):
class Meta:
model = School
fields = ['name']
class CreateUser(forms.ModelForm):
class Meta:
model = User
fields = [
'username',
'first_name',
'last_name',
'email',
'groups',
'password',
]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['password'].widget = forms.PasswordInput()
class EditPhone(forms.ModelForm):
class Meta:
model = School
fields = ['phone']
class EditLogo(forms.ModelForm):
class Meta:
model = School
fields = ['logo']
class EditMail(forms.ModelForm):
class Meta:
model = User
fields = ['email']
class EditJury1(forms.ModelForm):
class Meta:
model = School
fields = [
'first_name_j1',
'last_name_j1',
'phone_j1',
'mail_j1'
]
class EditJury2(forms.ModelForm):
class Meta:
model = School
fields = [
'first_name_j2',
'last_name_j2',
'phone_j2',
'mail_j2'
]