]> git.parisson.com Git - mezzo.git/commitdiff
Home : slider + repair debug bar tool
authorEmilie <zawadzki@ircam.fr>
Fri, 19 Aug 2016 16:01:03 +0000 (18:01 +0200)
committerEmilie <zawadzki@ircam.fr>
Fri, 19 Aug 2016 16:01:03 +0000 (18:01 +0200)
app/organization/featured/urls.py
app/organization/featured/views.py
app/organization/pages/urls.py
app/organization/pages/views.py
app/settings.py
app/templates/home/inc/slider.html [new file with mode: 0644]
app/templates/index.html

index b321eb24e8980fa035694529bedc34f8142e9a17..db08f17a41b34c1867bd2dfc2930591d6e05967d 100644 (file)
@@ -6,8 +6,6 @@ from django.conf.urls.i18n import i18n_patterns
 
 from mezzanine.core.views import direct_to_template
 from mezzanine.conf import settings
-from organization.featured.views import HomeView
 
 urlpatterns = [
-    url("^$", HomeView.as_view(), name="home"),
 ]
index d77ed90ec5104370546ff2d9f764801eedd8aceb..495a1d894081886b7c990ba57e2ed387884d8b9f 100644 (file)
@@ -2,16 +2,3 @@ from django.shortcuts import render
 from django.views.generic import DetailView, ListView, TemplateView
 from organization.core.views import SlugMixin
 from organization.magazine.models import Brief
-
-class HomeView(SlugMixin, TemplateView):
-
-    template_name = 'index.html'
-    briefs = Brief.objects.all() # with .published, order by isn't working anymore
-
-    def get_context_data(self, **kwargs):
-        context = super(HomeView, self).get_context_data(**kwargs)
-        context['briefs'] = self.briefs
-        return context
-
-    def get_queryset(self, **kwargs):
-        return self.model.objects.published()
index cd440ab6c701601bccd891d0baa9793585bd1ca9..01dc2bddecac25c1513cc25f3ec911260534fdaf 100644 (file)
@@ -6,11 +6,12 @@ from django.contrib import admin
 
 from mezzanine.core.views import direct_to_template
 from mezzanine.conf import settings
-from organization.pages.views import DynamicContentHomeSliderView, DynamicContentHomeBodyView
+from organization.pages.views import DynamicContentHomeSliderView, DynamicContentHomeBodyView, HomeView
 
 _slash = "/" if settings.APPEND_SLASH else ""
 
 urlpatterns = [
+    url("^$", HomeView.as_view(), name="home"),
     url("^dynamic-content-home-slider/$", DynamicContentHomeSliderView.as_view(), name='dynamic-content-home-slider'),
     url("^dynamic-content-home-body/$", DynamicContentHomeBodyView.as_view(), name='dynamic-content-home-body'),
 ]
index c5227fc6e0f86aa82238859414f3c8eeebfa1ad3..54de21b0b70a3b4bee02ceca0ec9ce6ebc8edade 100644 (file)
@@ -1,11 +1,28 @@
 from django.shortcuts import render
-
-# Create your views here.
+from django.views.generic import DetailView, ListView, TemplateView
 from dal import autocomplete
 from dal_select2_queryset_sequence.views import Select2QuerySetSequenceView
 from mezzanine_agenda.models import Event
 from organization.core.models import BasicPage
+from organization.core.views import SlugMixin
 from organization.magazine.models import Article, Topic, Brief
+from organization.pages.models import Home
+
+class HomeView(SlugMixin, ListView):
+
+    model = Home
+    template_name = 'index.html'
+    briefs = Brief.objects.all() # with .published, order by isn't working anymore
+    context_object_name = 'home'
+
+    def get_queryset(self, **kwargs):
+        return self.model.objects.published().latest("publish_date")
+
+    def get_context_data(self, **kwargs):
+        context = super(HomeView, self).get_context_data(**kwargs)
+        context['briefs'] = self.briefs
+        return context
+
 
 
 class DynamicContentHomeSliderView(Select2QuerySetSequenceView):
index 7cd057a36d92df08d9aa10096f58c918318c70f9..7c46b16f4ff76f77000b655dbbbca4cf6b756213 100644 (file)
@@ -327,7 +327,7 @@ OPTIONAL_APPS = (
 )
 
 if DEBUG:
-    OPTIONAL_APPS += "debug_toolbar"
+    OPTIONAL_APPS += ("debug_toolbar",)
 
 ##################
 # LOCAL SETTINGS #
diff --git a/app/templates/home/inc/slider.html b/app/templates/home/inc/slider.html
new file mode 100644 (file)
index 0000000..786e7f9
--- /dev/null
@@ -0,0 +1,12 @@
+<hr/>
+<h1>Slider</h1>
+<be/>
+{% for slider in home.dynamiccontenthomeslider_set.all %}
+<h2>{{ slider.content_object.title }}<h2><br/>
+<img src="{{ MEDIA_URL }}{{ slider.content_object.photo_slider }}" title="{{ slider.content_object.photo_slider_credits }}" /><br/>
+{{ slider.content_object.photo_slider_credits }}<br/>
+<a href="{{ slider.content_object.get_absolute_url }}" title="{{ slider.content_object.title }}">{{ slider.content_object.title }}</a><br/>
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>
+{% endfor %}
+<br/>
+<hr/>
index 56fedf4d8aa7083eaa1b235c3a067b0a76eaaf5e..4ad37c1cdc8d4530782499e02a40ed805282ee76 100644 (file)
@@ -10,6 +10,7 @@
 {% block content_header %}{% endblock %}
 
 {% block main %}
+{% include "home/inc/slider.html" %}
 {% page_menu "pages/menus/magazine.html" %}
 {% include "magazine/brief/brief_list.html" %}