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"),
]
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()
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'),
]
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):
)
if DEBUG:
- OPTIONAL_APPS += "debug_toolbar"
+ OPTIONAL_APPS += ("debug_toolbar",)
##################
# LOCAL SETTINGS #
--- /dev/null
+<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/>
{% block content_header %}{% endblock %}
{% block main %}
+{% include "home/inc/slider.html" %}
{% page_menu "pages/menus/magazine.html" %}
{% include "magazine/brief/brief_list.html" %}