добавил чойсы для рейтинга

изменил фасет вывод периода
remotes/origin/stage5
Alexander Burdeiny 10 years ago
parent de3475635f
commit de3a3436a1
  1. 18
      events/forms.py
  2. 1
      events/views.py
  3. 1
      fabfile.py
  4. 2
      support/dev/settings.py
  5. 2
      support/prod/settings.py

@ -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):

@ -66,7 +66,6 @@ class FilterListView(ContextMixin, FormMixin, ListView):
def get_context_data(self, **kwargs):
context = super(FilterListView, self).get_context_data(**kwargs)
# get params for paginator
get = self.form.data.copy()
if 'page' in get:

1
fabfile.py vendored

@ -188,6 +188,7 @@ def update_crontab():
def t1461():
with cd(REMOTE_HOME_DIR):
run('pip install chainmap==1.0.2')
run('pip install suds==0.4')
run('python manage.py migrate conference')
run('python manage.py migrate exposition')
run('python manage.py update_events_filter_fields')

@ -153,7 +153,7 @@ MIDDLEWARE_CLASSES = (
# Uncomment the next line for simple clickjacking protection:
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
'proj.middleware.RedirectFallbackMiddleware',
'proj.middleware.ExpoRedirectFallbackMiddleware',
)

@ -153,7 +153,7 @@ MIDDLEWARE_CLASSES = (
# Uncomment the next line for simple clickjacking protection:
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
'proj.middleware.RedirectFallbackMiddleware',
'proj.middleware.ExpoRedirectFallbackMiddleware',
)

Loading…
Cancel
Save