mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-07-05 05:04:04 +02:00
My account form
This commit is contained in:
@ -15,7 +15,7 @@ from django_tables2 import SingleTableView
|
||||
from tournament.forms import TeamForm, JoinTeam
|
||||
from tournament.models import Team
|
||||
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 .tables import UserTable
|
||||
|
||||
@ -28,9 +28,12 @@ class CreateUserView(CreateView):
|
||||
|
||||
class MyAccountView(LoginRequiredMixin, UpdateView):
|
||||
model = TFJMUser
|
||||
form_class = TFJMUserForm
|
||||
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):
|
||||
return self.request.user
|
||||
|
||||
|
Reference in New Issue
Block a user