From: Radek Czajka Date: Mon, 18 Mar 2019 09:56:56 +0000 (+0100) Subject: Separate club join view for app users. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/7538e73c6e0b33485bcaa42718232badecdf9e90?ds=sidebyside Separate club join view for app users. --- diff --git a/src/club/templates/club/membership_form_app.html b/src/club/templates/club/membership_form_app.html new file mode 100644 index 000000000..62ad6883a --- /dev/null +++ b/src/club/templates/club/membership_form_app.html @@ -0,0 +1,21 @@ +{% extends "base/app.html" %} + + +{% block titleextra %}Towarzystwo Wolnych Lektur{% endblock %} + + +{% block body %} +
+ +

{% if membership %}Odnów swoje członkostwo w Towarzystwie Wolnych Lektur{% else %}Dołącz do Towarzystwa Wolnych Lektur{% endif %}

+ +
+ {% csrf_token %} + + {{ form.as_p }} + +
+ +
+ +{% endblock %} diff --git a/src/club/urls.py b/src/club/urls.py index 0a8b53a4e..dcefc222d 100644 --- a/src/club/urls.py +++ b/src/club/urls.py @@ -5,6 +5,7 @@ from . import views urlpatterns = [ url(r'^$', views.ClubView.as_view()), url(r'^dolacz/$', views.JoinView.as_view(), name='club_join'), + url(r'^dolacz/app/$', views.AppJoinView.as_view(), name='club_join'), url(r'^plan/(?P[-a-z0-9]+)/$', views.ScheduleView.as_view(), name='club_schedule'), url(r'^przylacz/(?P[-a-z0-9]+)/$', views.claim, name='club_claim'), diff --git a/src/club/views.py b/src/club/views.py index e6dc996e0..1393b9693 100644 --- a/src/club/views.py +++ b/src/club/views.py @@ -13,8 +13,8 @@ class ClubView(TemplateView): class JoinView(CreateView): - template_name = 'club/membership_form.html' form_class = ScheduleForm + template_name = 'club/membership_form.html' def get(self, request): schedule = get_active_schedule(request.user) @@ -23,7 +23,7 @@ class JoinView(CreateView): else: return super(JoinView, self).get(request) - def get_context_data(self): + def get_context_data(self, form=None): c = super(JoinView, self).get_context_data() c['membership'] = getattr(self.request.user, 'membership', None) return c @@ -42,6 +42,10 @@ class JoinView(CreateView): return retval +class AppJoinView(JoinView): + template_name = 'club/membership_form_app.html' + + class ScheduleView(View): def get(self, request, key): schedule = models.Schedule.objects.get(key=key) diff --git a/src/wolnelektury/templates/base/app.html b/src/wolnelektury/templates/base/app.html new file mode 100644 index 000000000..b89377359 --- /dev/null +++ b/src/wolnelektury/templates/base/app.html @@ -0,0 +1,106 @@ + +{% spaceless %} + + {% load pipeline i18n %} + {% load static from staticfiles %} + {% load catalogue_tags funding_tags reporting_stats %} + {% load piwik_tags %} + {% load ssi_include ssi_csrf_token from ssify %} + {% load user_username user_is_staff from common_tags %} + {% load cache %} + {% get_current_language as LANGUAGE_CODE %} + + + + + + + + + + {% block ogextra %}{% endblock %} + + + {% block title %}{% block titleextra %}{{ page_title }}{% endblock %} :: {% trans "Wolne Lektury" %}{% endblock %} + + + + + {% stylesheet "main" %} + {% block extrahead %}{% endblock %} + + + + {% block bodycontent %} + +
+
+
+ + +
+ + ⚐ + {% trans "Language" %} + +
+ {% for lang in LANGUAGES %} +
+ {% ssi_csrf_token %} + + +
+ {% endfor %} +
+
+ + +
+
+
+ +
+ {% block body %} + {% endblock %} +
+
+ + {% endblock bodycontent %} + + + + {% javascript "base" %} + + {% tracking_code %} + + {% block extrabody %}{% endblock %} + + + + +{% endspaceless %}