|
|
|
|
@ -1,18 +1,13 @@ |
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
|
|
from django.core.urlresolvers import reverse, reverse_lazy |
|
|
|
|
from django.core.urlresolvers import reverse_lazy |
|
|
|
|
from django.db.models import Q |
|
|
|
|
from django.http import Http404 |
|
|
|
|
from django.http import HttpResponseForbidden |
|
|
|
|
from django.http import HttpResponseNotFound |
|
|
|
|
from django.http import HttpResponsePermanentRedirect |
|
|
|
|
from django.views.generic.edit import FormMixin, FormView |
|
|
|
|
from django.conf import settings |
|
|
|
|
from django.template.loader import render_to_string |
|
|
|
|
from django.template import RequestContext |
|
|
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
|
|
|
|
|
|
|
from haystack.query import SearchQuerySet |
|
|
|
|
|
|
|
|
|
from emencia.django.newsletter.forms import ContactForm |
|
|
|
|
from emencia.django.newsletter.models import Contact |
|
|
|
|
@ -31,7 +26,7 @@ class FilterListView_(ContextMixin, FormMixin, ListView): |
|
|
|
|
initial_ctx = {'filtering': True} |
|
|
|
|
form_class = FilterForm |
|
|
|
|
paginate_by = settings.CLIENT_PAGINATION |
|
|
|
|
template_name = 'events/filter_listview.html' |
|
|
|
|
template_name = 'client/events/filter_listview.html' |
|
|
|
|
_ajax_results_template_name = 'events/filter_listview_ajax.html' |
|
|
|
|
_ajax_form_template_name = 'includes/events/filter_form.html' |
|
|
|
|
|
|
|
|
|
@ -43,13 +38,10 @@ class FilterListView_(ContextMixin, FormMixin, ListView): |
|
|
|
|
def get_queryset(self): |
|
|
|
|
if self.form.is_valid(): |
|
|
|
|
qs = self.form.filter() |
|
|
|
|
# import pdb; pdb.set_trace() |
|
|
|
|
else: |
|
|
|
|
qs = self.form.default_filter() |
|
|
|
|
if self.kwargs.get('with_form', True): |
|
|
|
|
self.form.recalculate_choices() |
|
|
|
|
# print(self.form.data, self.form.cleaned_data, self.form.get_date_begin_periods()) |
|
|
|
|
# import pdb; pdb.set_trace() |
|
|
|
|
return qs |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
@ -86,6 +78,7 @@ class FilterListView_(ContextMixin, FormMixin, ListView): |
|
|
|
|
|
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FilterListView(ReverseOrderMixin, FilterListView_): |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|