Merge branch 'develop' of git.general-servers.com:expomap/expomap into develop

remotes/origin/1203
Ivan Kovalkovskyi 11 years ago
commit 2c7a171756
  1. 2
      article/models.py
  2. 3
      conference/forms.py
  3. 6
      exposition/forms.py
  4. 18
      specialist_catalog/urls.py
  5. 23
      specialist_catalog/views.py
  6. 2
      templates/client/includes/article/news_on_main_logo.html

@ -45,7 +45,7 @@ class ArticleManager(TranslationManager):
if cached_news: if cached_news:
return cached_news return cached_news
else: else:
news = list(self.news().filter(publish_date__isnull=False).order_by('-main_page', '-publish_date')[:3]) news = list(self.news().filter(publish_date__isnull=False).order_by('-main_page', '-publish_date', '-modified')[:3])
cache.set(key, news, self.cache_time) cache.set(key, news, self.cache_time)
return news return news

@ -132,7 +132,8 @@ class ConferenceCreateForm(forms.Form):
else: else:
conference = obj conference = obj
conference.theme.clear() conference.theme.clear()
conference.tag.clear() if data.get('tag'):
conference.tag.clear()
#simple fields #simple fields
if not getattr(conference, 'url'): if not getattr(conference, 'url'):

@ -161,9 +161,11 @@ class ExpositionCreateForm(forms.Form):
else: else:
exposition = obj exposition = obj
exposition.theme.clear() exposition.theme.clear()
exposition.tag.clear()
exposition.organiser.clear() exposition.organiser.clear()
#exposition.company.clear() if data.get('tag'):
exposition.tag.clear()
#simple fields #simple fields
if not getattr(exposition, 'url'): if not getattr(exposition, 'url'):

@ -1,11 +1,19 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import url, patterns from django.conf.urls import url, patterns
from .views import CatalogDetailedView, SpecCatalog from .views import CatalogDetailedView, SpecCatalog, redirect_old
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^city/$', SpecCatalog.as_view(), {'type': 'city'}, name="spec_city"), url(r'^city/(?P<city>.*)/all/page/(?P<page>\d+)/$', redirect_old, {'type': 'city'}),
url(r'^country/$', SpecCatalog.as_view(), {'type': 'country'}, name="spec_country"), url(r'^city/(?P<city>.*)/all/$', redirect_old, {'type': 'city'}),
url(r'^city/$', SpecCatalog.as_view(), {'type': 'city', 'meta_id': 86}, name="spec_city"),
url(r'^city/(?P<slug>.*)/$', CatalogDetailedView.as_view(), {'type': 'city', 'meta_id': 88}, name="spec_catalog_city"),
url(r'^city/(?P<slug>.*)/$', CatalogDetailedView.as_view(), {'type': 'city'}, name="spec_catalog_city"), url(r'^country/(?P<country>.*)/all/page/(?P<page>\d+)/$', redirect_old),
url(r'^country/(?P<slug>.*)/$', CatalogDetailedView.as_view(), {'type': 'country'}, name="spec_catalog_country"), url(r'^country/(?P<country>.*)/all/$', redirect_old),
url(r'^country/$', SpecCatalog.as_view(), {'type': 'country', 'meta_id': 86}, name="spec_country"),
url(r'^country/(?P<slug>.*)/$', CatalogDetailedView.as_view(), {'type': 'country', 'meta_id': 87}, name="spec_catalog_country"),
url(r'^(?P<slug>.*)/$', redirect_old),
url(r'^page/(?P<page>\d+)/$', redirect_old),
url(r'^$', redirect_old),
) )

@ -3,12 +3,13 @@ from django.views.generic import CreateView, UpdateView, DeleteView, FormView,
from functions.custom_views import ListView from functions.custom_views import ListView
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from meta.views import MetadataMixin
from .forms import * from .forms import *
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.conf import settings from django.conf import settings
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from service.order_forms import TranslationForm from service.order_forms import TranslationForm
from django.http import HttpResponseRedirect, Http404 from django.http import HttpResponseRedirect, Http404, HttpResponsePermanentRedirect
from .models import _city, _country from .models import _city, _country
@ -147,7 +148,7 @@ class FeedbackDeleteView(DeleteView):
# ========= CLIENT VIEWS ============ # ========= CLIENT VIEWS ============
class CatalogDetailedView(SingleObjectMixin, FormView): class CatalogDetailedView(MetadataMixin, SingleObjectMixin, FormView):
model = SpecialistCatalog model = SpecialistCatalog
form_class = TranslationForm form_class = TranslationForm
template_name = "client/specialist_catalog/catalog_detailed.html" template_name = "client/specialist_catalog/catalog_detailed.html"
@ -156,12 +157,16 @@ class CatalogDetailedView(SingleObjectMixin, FormView):
def get_catalog_obj(self): def get_catalog_obj(self):
if self.kwargs.get('type') is "country": if self.kwargs.get('type') is "country":
try: try:
return self.model.objects.language().get(type=1, country__url=self.kwargs.get('slug')) spec_catalog = self.model.objects.language().get(type=1, country__url=self.kwargs.get('slug'))
self.kwargs['country'] = spec_catalog.country
return spec_catalog
except self.model.DoesNotExist: except self.model.DoesNotExist:
raise Http404 raise Http404
else: else:
try: try:
return self.model.objects.language().get(type=2, city__url=self.kwargs.get('slug')) spec_catalog = self.model.objects.language().get(type=2, city__url=self.kwargs.get('slug'))
self.kwargs['city'] = spec_catalog.city
return spec_catalog
except self.model.DoesNotExist: except self.model.DoesNotExist:
raise Http404 raise Http404
@ -189,7 +194,7 @@ class CatalogDetailedView(SingleObjectMixin, FormView):
init['city'] = obj.city.name init['city'] = obj.city.name
return init return init
class SpecCatalog(ListView): class SpecCatalog(MetadataMixin, ListView):
model = SpecialistCatalog model = SpecialistCatalog
template_name = 'client/specialist_catalog/catalog.html' template_name = 'client/specialist_catalog/catalog.html'
@ -215,3 +220,11 @@ class SpecCatalog(ListView):
else: else:
context['title'] = _(u'Переводчики по городам') context['title'] = _(u'Переводчики по городам')
return context return context
def redirect_old(request, *args, **kwargs):
if not kwargs.get('type'):
return HttpResponsePermanentRedirect('/translators/country/')
else:
return HttpResponsePermanentRedirect('/translators/city/')

@ -2,7 +2,7 @@
{% load thumbnail %} {% load thumbnail %}
{% if obj.logo %} {% if obj.logo %}
{% thumbnail obj.logo "80x80" format="PNG" as im %} {% thumbnail obj.logo "70x70" format="PNG" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" class="pic" alt=""> <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" class="pic" alt="">
{% endthumbnail %} {% endthumbnail %}
{% else %} {% else %}

Loading…
Cancel
Save