Commit 33fc3569 authored by Charlie Jacomme's avatar Charlie Jacomme

[club] Possibilité pour un cableur d'afficher un club

parent c9fec45b
......@@ -4,6 +4,7 @@ import views
urlpatterns = [
url('^$', views.IndexView.as_view(), name='index'),
url('^liste/(?P<cid>[0-9]+)/$', views.IndexView.as_view(), name='index'),
url('^(?P<cid>[0-9]+)/imprimeur/ajouter$', views.ImprimeurAddView.as_view(), name='imprimeur_add'),
url('^(?P<cid>[0-9]+)/imprimeur/retirer$', views.ImprimeurDelView.as_view(), name='imprimeur_del'),
]
......@@ -16,10 +16,16 @@ from intranet import conn_pool
class IndexView(TemplateView):
template_name = 'club/index.html'
def get_context_data(self, *args, **kwargs):
def get_context_data(self, cid = None, *args, **kwargs):
context = super(IndexView, self).get_context_data(*args, **kwargs)
clubs = []
for (club_name, club) in get_clubs_for_user(self.request.user):
if cid and self.request.user.has_perm('auth.crans_cableur'):
club = conn_pool.get_conn(self.request.user).search(u'cid=%s' % cid)[0]
user_clubs = [(unicode(club['nom'][0]),club)]
context.update({'cablage' : True})
else:
user_clubs = get_clubs_for_user(self.request.user)
for (club_name, club) in user_clubs:
imprimeurs = get_imprimeurs_for_club(club)
club_dict = {
'club_name': club_name,
......
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