Commit 39661b8d authored by Skia's avatar Skia
Browse files

Add new club view

parent 6ef39257
Pipeline #23 failed with stage
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% block content %} {% block content %}
<h2>Edit club properties</h2> <h2>Edit club properties</h2>
<form action="{{ url('club:club_prop', club_id=club.id) }}" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{{ form.as_p() }} {{ form.as_p() }}
<p><input type="submit" value="Save!" /></p> <p><input type="submit" value="Save!" /></p>
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
{%- endmacro %} {%- endmacro %}
{% block content %} {% block content %}
{% if user.is_superuser or user.is_in_group(settings.SITH_GROUPS['root']['name']) %}
<p><a href="{{ url('club:club_new') }}">New club</a></p>
{% endif %}
{% if club_list %} {% if club_list %}
<h3>Club list</h3> <h3>Club list</h3>
<ul> <ul>
......
...@@ -4,6 +4,7 @@ from club.views import * ...@@ -4,6 +4,7 @@ from club.views import *
urlpatterns = [ urlpatterns = [
url(r'^$', ClubListView.as_view(), name='club_list'), url(r'^$', ClubListView.as_view(), name='club_list'),
url(r'^new$', ClubCreateView.as_view(), name='club_new'),
url(r'^(?P<club_id>[0-9]+)/$', ClubView.as_view(), name='club_view'), url(r'^(?P<club_id>[0-9]+)/$', ClubView.as_view(), name='club_view'),
url(r'^(?P<club_id>[0-9]+)/edit$', ClubEditView.as_view(), name='club_edit'), url(r'^(?P<club_id>[0-9]+)/edit$', ClubEditView.as_view(), name='club_edit'),
url(r'^(?P<club_id>[0-9]+)/members$', ClubMembersView.as_view(), name='club_members'), url(r'^(?P<club_id>[0-9]+)/members$', ClubMembersView.as_view(), name='club_members'),
......
...@@ -97,3 +97,13 @@ class ClubEditPropView(CanEditPropMixin, UpdateView): ...@@ -97,3 +97,13 @@ class ClubEditPropView(CanEditPropMixin, UpdateView):
fields = ['name', 'unix_name', 'parent'] fields = ['name', 'unix_name', 'parent']
template_name = 'club/club_edit_prop.jinja' template_name = 'club/club_edit_prop.jinja'
class ClubCreateView(CanEditPropMixin, CreateView):
"""
Create a club (for the Sith admin)
"""
model = Club
pk_url_kwarg = "club_id"
fields = ['name', 'unix_name', 'parent']
template_name = 'club/club_edit_prop.jinja'
...@@ -48,6 +48,24 @@ Welcome to the wiki page! ...@@ -48,6 +48,24 @@ Welcome to the wiki page!
s.save() s.save()
s.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id] s.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id]
s.save() s.save()
# Adding user public
public = User(username='public', last_name="Not subscribed", first_name="Public",
email="public@git.an",
date_of_birth="1942-06-12",
is_superuser=False, is_staff=False)
public.set_password("plop")
public.save()
public.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id]
public.save()
# Adding user Subscriber
subscriber = User(username='subscriber', last_name="User", first_name="Subscribed",
email="Subscribed@git.an",
date_of_birth="1942-06-12",
is_superuser=False, is_staff=False)
subscriber.set_password("plop")
subscriber.save()
subscriber.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id]
subscriber.save()
# Adding user Guy # Adding user Guy
u = User(username='guy', last_name="Carlier", first_name="Guy", u = User(username='guy', last_name="Carlier", first_name="Guy",
email="guy@git.an", email="guy@git.an",
...@@ -87,6 +105,9 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site. ...@@ -87,6 +105,9 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
## Richard ## Richard
Subscription(member=Subscriber.objects.filter(pk=r.pk).first(), subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[0], Subscription(member=Subscriber.objects.filter(pk=r.pk).first(), subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[0],
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0]).save() payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0]).save()
## Subscriber
Subscription(member=Subscriber.objects.filter(pk=subscriber.pk).first(), subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[0],
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0]).save()
# Clubs # Clubs
Club(name="Bibo'UT", unix_name="bibout", Club(name="Bibo'UT", unix_name="bibout",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment