From: Emilie Date: Tue, 7 Feb 2017 14:13:01 +0000 (+0100) Subject: [Home] add person on slider X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=fb9d31fded5ccc845369174060469186c346bd77;p=mezzo.git [Home] add person on slider --- diff --git a/app/organization/pages/forms.py b/app/organization/pages/forms.py index a3512c81..2b133274 100644 --- a/app/organization/pages/forms.py +++ b/app/organization/pages/forms.py @@ -33,6 +33,7 @@ from organization.pages.models import CustomPage from organization.pages.models import * from organization.agenda.models import Event from organization.media.models import Playlist +from organization.network.models import Person class DynamicContentHomeSliderForm(autocomplete.FutureModelForm): @@ -41,7 +42,8 @@ class DynamicContentHomeSliderForm(autocomplete.FutureModelForm): queryset=autocomplete.QuerySetSequence( Article.objects.all(), CustomPage.objects.all(), - Event.objects.all() + Event.objects.all(), + Person.objects.published() ), required=False, widget=dal_select2_queryset_sequence.widgets.QuerySetSequenceSelect2('dynamic-content-home-slider'), diff --git a/app/organization/pages/views.py b/app/organization/pages/views.py index 6d0e6118..e7618946 100644 --- a/app/organization/pages/views.py +++ b/app/organization/pages/views.py @@ -34,6 +34,8 @@ from organization.magazine.models import Article, Topic, Brief from organization.pages.models import Home from organization.agenda.models import Event from organization.media.models import Playlist +from organization.network.models import Person + class HomeView(SlugMixin, ListView): @@ -61,13 +63,16 @@ class DynamicContentHomeSliderView(Select2QuerySetSequenceView): articles = Article.objects.all() custompage = CustomPage.objects.all() events = Event.objects.all() + persons = Person.objects.published() + if self.q: articles = articles.filter(title__icontains=self.q) custompage = custompage.filter(title__icontains=self.q) events = events.filter(title__icontains=self.q) + persons = persons.filter(title__icontains=self.q) - qs = autocomplete.QuerySetSequence(articles, custompage, events) + qs = autocomplete.QuerySetSequence(articles, custompage, events, persons) if self.q: # This would apply the filter on all the querysets @@ -166,4 +171,4 @@ class DynamicContentPageView(Select2QuerySetSequenceView): def get_results(self, context): results = autocomplete_result_formatting(self, context) - return results + return results diff --git a/app/settings.py b/app/settings.py index c1a24abf..3a84f1a0 100644 --- a/app/settings.py +++ b/app/settings.py @@ -138,7 +138,7 @@ LOCALE_PATHS = ['locale',] SESSION_EXPIRE_AT_BROWSER_CLOSE = False SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" -SITE_ID = 1 +SITE_ID = 3 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery.