Use Django flatpages mechanism for mil home page
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 18 Oct 2013 07:42:15 +0000 (09:42 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 22 Oct 2013 07:49:53 +0000 (09:49 +0200)
edumed/milurls.py
edumed/templates/base_mil.html
edumed/templates/flatpages/mil.html [new file with mode: 0644]

index 89a65c5..0b3ea6c 100644 (file)
@@ -1,15 +1,19 @@
-from django.conf.urls import include, url
+from django.conf.urls import include, url, patterns
 
 from fnpdjango.utils.urls import i18n_patterns
 from .views import MILHomeView
 
 
 urlpatterns = i18n_patterns('',
 
 from fnpdjango.utils.urls import i18n_patterns
 from .views import MILHomeView
 
 
 urlpatterns = i18n_patterns('',
-    url(r'^$', MILHomeView.as_view(), name="mil_home"),
     url(r'^kompetencje/', include('curriculum.urls')),
     url(r'^wez-udzial/', include('comment.urls'))
 )
 
     url(r'^kompetencje/', include('curriculum.urls')),
     url(r'^wez-udzial/', include('comment.urls'))
 )
 
+urlpatterns += patterns('',
+    url(r'^$', 'django.contrib.flatpages.views.flatpage', {'url': '/'}, name="mil_home_pl"),
+    url(r'^en/$', 'django.contrib.flatpages.views.flatpage', {'url': '/en/'}, name="mil_home_en")
+)
+
 handler404 = 'edumed.views.mil_404_view'
 
 
 handler404 = 'edumed.views.mil_404_view'
 
 
index e5300e6..dec800b 100644 (file)
@@ -5,7 +5,7 @@
 {% load i18n %}
 
 {% block top_navigation %}
 {% load i18n %}
 
 {% block top_navigation %}
-    <li><a class="menu-wspolpraca" href="{% url "mil_home" %}">{% trans 'Consultations' %}</a></li>
+    <li><a class="menu-wspolpraca" href="{% if request.LANGUAGE_CODE == 'pl' %}{% url "mil_home_pl" %}{% else %}{% url "mil_home_en" %}{% endif %}">{% trans 'Consultations' %}</a></li>
         <li><a class="menu-kompetencje" href="{% url "curriculum" %}">{% trans 'Competencies' %}</a></li>
         <li><a class="menu-wspolpraca" href="/wez-udzial">{% trans 'Take Part' %}</a></li>
         {% if request.LANGUAGE_CODE == 'pl' %}
         <li><a class="menu-kompetencje" href="{% url "curriculum" %}">{% trans 'Competencies' %}</a></li>
         <li><a class="menu-wspolpraca" href="/wez-udzial">{% trans 'Take Part' %}</a></li>
         {% if request.LANGUAGE_CODE == 'pl' %}
diff --git a/edumed/templates/flatpages/mil.html b/edumed/templates/flatpages/mil.html
new file mode 100644 (file)
index 0000000..5ac86a6
--- /dev/null
@@ -0,0 +1,10 @@
+{% extends "base_mil.html" %}
+{% load textile_pl from fnp_markup %}
+
+{% block title %}{{ flatpage.title }}{% endblock %}
+
+{% block body %}
+<div id="main-bar" class="flatpage">
+{{ flatpage.content|textile_pl }}
+</div>
+{% endblock %}