mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 07:02:22 +00:00
My account form
This commit is contained in:
parent
3889256fb1
commit
4534a278d7
@ -42,4 +42,19 @@ class SignUpForm(UserCreationForm):
|
|||||||
class TFJMUserForm(forms.ModelForm):
|
class TFJMUserForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TFJMUser
|
model = TFJMUser
|
||||||
fields = '__all__'
|
fields = ('last_name', 'first_name', 'email', 'phone_number', 'gender', 'birth_date', 'address', 'postal_code',
|
||||||
|
'city', 'country', 'school', 'student_class', 'responsible_name', 'responsible_phone',
|
||||||
|
'responsible_email',)
|
||||||
|
|
||||||
|
|
||||||
|
class CoachUserForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = TFJMUser
|
||||||
|
fields = ('last_name', 'first_name', 'email', 'phone_number', 'gender', 'birth_date', 'address', 'postal_code',
|
||||||
|
'city', 'country', 'description',)
|
||||||
|
|
||||||
|
|
||||||
|
class AdminUserForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = TFJMUser
|
||||||
|
fields = ('last_name', 'first_name', 'email', 'phone_number', 'description',)
|
||||||
|
@ -15,7 +15,7 @@ from django_tables2 import SingleTableView
|
|||||||
from tournament.forms import TeamForm, JoinTeam
|
from tournament.forms import TeamForm, JoinTeam
|
||||||
from tournament.models import Team
|
from tournament.models import Team
|
||||||
from tournament.views import AdminMixin, TeamMixin
|
from tournament.views import AdminMixin, TeamMixin
|
||||||
from .forms import SignUpForm, TFJMUserForm
|
from .forms import SignUpForm, TFJMUserForm, AdminUserForm, CoachUserForm
|
||||||
from .models import TFJMUser, Document, Solution, MotivationLetter, Synthesis
|
from .models import TFJMUser, Document, Solution, MotivationLetter, Synthesis
|
||||||
from .tables import UserTable
|
from .tables import UserTable
|
||||||
|
|
||||||
@ -28,9 +28,12 @@ class CreateUserView(CreateView):
|
|||||||
|
|
||||||
class MyAccountView(LoginRequiredMixin, UpdateView):
|
class MyAccountView(LoginRequiredMixin, UpdateView):
|
||||||
model = TFJMUser
|
model = TFJMUser
|
||||||
form_class = TFJMUserForm
|
|
||||||
template_name = "member/my_account.html"
|
template_name = "member/my_account.html"
|
||||||
|
|
||||||
|
def get_form_class(self):
|
||||||
|
return AdminUserForm if self.request.user.organizes else TFJMUserForm \
|
||||||
|
if self.request.user.role == "3participant" else CoachUserForm
|
||||||
|
|
||||||
def get_object(self, queryset=None):
|
def get_object(self, queryset=None):
|
||||||
return self.request.user
|
return self.request.user
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user