|
|
|
|
@ -31,7 +31,7 @@ from django.conf import settings |
|
|
|
|
from haystack.query import SearchQuerySet, RelatedSearchQuerySet, SQ |
|
|
|
|
|
|
|
|
|
from functions.model_utils import EnumChoices |
|
|
|
|
from functions.model_mixin import get_dates |
|
|
|
|
# from functions.model_mixin import get_dates |
|
|
|
|
from exposition.models import Exposition |
|
|
|
|
from conference.models import Conference |
|
|
|
|
from theme.models import Theme, Tag |
|
|
|
|
@ -164,6 +164,13 @@ values_mapping = { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RATING = ( |
|
|
|
|
(1, _(u'Топовые (HIT)')), |
|
|
|
|
(2, _(u'Члены РСВЯ')), |
|
|
|
|
(3, _(u'Члены UFI')), |
|
|
|
|
(4, _(u'ExpoRating')), |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
monthes_abr_to_num = {v.lower(): k for k, v in enumerate(calendar.month_abbr)} |
|
|
|
|
monthes_num_to_abr = {v: k for k, v in monthes_abr_to_num.iteritems()} |
|
|
|
|
year_month_regex = re.compile(r'^((?P<year>\d{4})(?P<month>\w{3}))|((?P<month_>\d{1,2})/(?P<year_>\d{4}))$') |
|
|
|
|
@ -242,7 +249,7 @@ class FilterForm(forms.Form): |
|
|
|
|
required=False, widget=FilterCheckboxSelectMultiple()) |
|
|
|
|
rating = FilterTypedMultipleChoiceField( |
|
|
|
|
label=_(u'Рейтинги'), coerce=int, |
|
|
|
|
choices=[], |
|
|
|
|
choices=RATING, |
|
|
|
|
required=False, widget=FilterCheckboxSelectMultiple()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -273,7 +280,12 @@ class FilterForm(forms.Form): |
|
|
|
|
def get_dates(self): |
|
|
|
|
if not (self.cleaned_data.get('date_from') or self.cleaned_data.get('date_to')): |
|
|
|
|
return None |
|
|
|
|
return get_dates(self.cleaned_data.get('date_from'), self.cleaned_data.get('date_to')) |
|
|
|
|
result = '' |
|
|
|
|
if self.cleaned_data.get('date_from'): |
|
|
|
|
result += _(u'c {date_from} ').format(date_from=self.cleaned_data.get('date_from').strftime('%d.%m.%Y')) |
|
|
|
|
if self.cleaned_data.get('date_to'): |
|
|
|
|
result += _(u'по {date_to}').format(date_to=self.cleaned_data.get('date_to').strftime('%d.%m.%Y')) |
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def month_choices(cls): |
|
|
|
|
|