site_tps/users/forms.py

73 lines
1.4 KiB
Python
Raw Normal View History

2018-03-08 23:53:38 +00:00
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']
2018-03-08 23:53:38 +00:00
class CreateUser(forms.ModelForm):
class Meta:
model = User
2018-03-10 13:48:48 +00:00
fields = [
'username',
'first_name',
'last_name',
'email',
'groups',
'password',
]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['password'].widget = forms.PasswordInput()
2018-03-08 23:53:38 +00:00
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'
]