mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 20:09:25 +00:00
Improve club templates
This commit is contained in:
@ -25,6 +25,11 @@ class ClubView(DetailView):
|
||||
pk_url_kwarg = "club_id"
|
||||
template_name = 'club/club_detail.jinja'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(ClubView, self).get_context_data(**kwargs)
|
||||
kwargs['tab'] = "infos"
|
||||
return kwargs
|
||||
|
||||
class ClubToolsView(CanEditMixin, DetailView):
|
||||
"""
|
||||
Tools page of a Club
|
||||
@ -33,6 +38,11 @@ class ClubToolsView(CanEditMixin, DetailView):
|
||||
pk_url_kwarg = "club_id"
|
||||
template_name = 'club/club_tools.jinja'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(ClubToolsView, self).get_context_data(**kwargs)
|
||||
kwargs['tab'] = "tools"
|
||||
return kwargs
|
||||
|
||||
class ClubMemberForm(forms.ModelForm):
|
||||
"""
|
||||
Form handling the members of a club
|
||||
@ -41,7 +51,7 @@ class ClubMemberForm(forms.ModelForm):
|
||||
required_css_class = 'required'
|
||||
class Meta:
|
||||
model = Membership
|
||||
fields = ['user', 'role']
|
||||
fields = ['user', 'role', 'description']
|
||||
|
||||
def clean(self):
|
||||
"""
|
||||
@ -87,6 +97,11 @@ class ClubMembersView(CanViewMixin, UpdateView):
|
||||
form._user = self.request.user
|
||||
return form
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(ClubMembersView, self).get_context_data(**kwargs)
|
||||
kwargs['tab'] = "members"
|
||||
return kwargs
|
||||
|
||||
class ClubEditView(CanEditMixin, UpdateView):
|
||||
"""
|
||||
Edit a Club's main informations (for the club's members)
|
||||
@ -96,6 +111,11 @@ class ClubEditView(CanEditMixin, UpdateView):
|
||||
fields = ['address']
|
||||
template_name = 'club/club_edit.jinja'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(ClubEditView, self).get_context_data(**kwargs)
|
||||
kwargs['tab'] = "edit"
|
||||
return kwargs
|
||||
|
||||
class ClubEditPropView(CanEditPropMixin, UpdateView):
|
||||
"""
|
||||
Edit the properties of a Club object (for the Sith admins)
|
||||
@ -105,6 +125,10 @@ class ClubEditPropView(CanEditPropMixin, UpdateView):
|
||||
fields = ['name', 'unix_name', 'parent']
|
||||
template_name = 'club/club_edit_prop.jinja'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(ClubEditPropView, self).get_context_data(**kwargs)
|
||||
kwargs['tab'] = "props"
|
||||
return kwargs
|
||||
|
||||
class ClubCreateView(CanEditPropMixin, CreateView):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user