merge conflict + All events in place

remotes/origin/tests
ya_dim4ik 9 years ago
commit 6bfd758391
  1. 5
      place_exposition/models.py
  2. 63
      place_exposition/urls.py
  3. 21
      place_exposition/views.py
  4. 2
      proj/urls.py
  5. 4
      templates/client/place/place_detail.html
  6. 100
      templates/client/place/place_exposition_list.html

@ -6,6 +6,7 @@ from django.db.models.signals import post_save, pre_save
from django.utils.translation import ugettext as _
from functools import partial
from django.conf import settings
from django.core.urlresolvers import reverse
from functions.translate import fill_with_signal
#
from hvad.models import TranslatableModel, TranslatedFields, TranslationManager
@ -152,10 +153,12 @@ class PlaceExposition(TranslatableModel, ExpoMixin):
titles = ' '.join([tr.main_title for tr in translations])
return names + ' ' + titles
def __unicode__(self):
return self.lazy_translation_getter('name', unicode(self.pk))
def get_absolute_url(self):
return reverse('place_detail', args=[self.url])
def get_object_type(self):
return _(u'Места')

@ -1,30 +1,57 @@
# -*- coding: utf-8 -*-
from django.conf.urls import include, patterns, url
from django.conf.urls import patterns, url
from .views import (
PlaceCityCatalog,
PlaceCountryCatalog,
PlaceDetail,
PlaceList,
PlacePhoto,
PlaceByCountry,
PlaceByCity,
PlaceCityCatalog, PlaceCountryCatalog, PlaceDetail, PlaceList, PlacePhoto,
PlaceByCountry, PlaceByCity, PlaceExpositionListView
)
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^country/$', PlaceByCountry.as_view(), {'meta_id': 49}),
url(r'^country/(?P<slug>.*)/page/(?P<page>\d+)/$', PlaceCountryCatalog.as_view(), {'meta_id': 49}),
url(r'^country/(?P<slug>.*)/$', PlaceCountryCatalog.as_view(), {'meta_id': 49}, name='place_country'),
url(
r'^country/(?P<slug>.*)/page/(?P<page>\d+)/$',
PlaceCountryCatalog.as_view(),
{'meta_id': 49}
),
url(
r'^country/(?P<slug>.*)/$',
PlaceCountryCatalog.as_view(),
{'meta_id': 49},
name='place_country'
),
url(r'^city/$', PlaceByCity.as_view(), {'meta_id': 48}),
url(r'^city/(?P<slug>.*)/page/(?P<page>\d+)/$', PlaceCityCatalog.as_view(), {'meta_id': 48}),
url(r'^city/(?P<slug>.*)/$', PlaceCityCatalog.as_view(), {'meta_id': 48}, name='place_city'),
url(
r'^city/(?P<slug>.*)/page/(?P<page>\d+)/$',
PlaceCityCatalog.as_view(),
{'meta_id': 48}
),
url(
r'^city/(?P<slug>.*)/$',
PlaceCityCatalog.as_view(),
{'meta_id': 48},
name='place_city'
),
url(r'^(?P<slug>.*)/photo/page/(?P<page>\d+)/$', PlacePhoto.as_view(), {'meta_id': 91}),
url(
r'^(?P<slug>.*)/photo/page/(?P<page>\d+)/$',
PlacePhoto.as_view(),
{'meta_id': 91}
),
url(r'^(?P<slug>.*)/photo/$', PlacePhoto.as_view(), {'meta_id': 91}),
url(r'^page/(?P<page>\d+)/$', PlaceList.as_view(), {'meta_id': 46}),
url(r'^(?P<slug>.*)/$', PlaceDetail.as_view(), {'meta_id': 47}),
url(r'^$', PlaceList.as_view(), {'meta_id':46}),
)
url(
r'^(?P<slug>.*)/expositions/$',
PlaceExpositionListView.as_view(),
name='place_exposition_list'
),
url(
r'^(?P<slug>.*)/$',
PlaceDetail.as_view(),
{'meta_id': 47},
name='place_detail'
),
url(r'^$', PlaceList.as_view(), {'meta_id': 46}),
)

@ -230,3 +230,24 @@ class PlaceCityCatalog(PlaceCatalog):
context = super(PlaceCityCatalog, self).get_context_data(**kwargs)
context['city'] = str(self.kwargs['city'].id)
return context
class PlaceExpositionListView(ListView):
"""
Представление перечня событий относительно места.
Переход на эту страницу происходит со страницы подробного просмотра
места, по ссылке "Все события"
"""
template_name = 'client/place/place_exposition_list.html'
def get_object(self):
slug = self.kwargs.get('slug')
return get_object_or_404(PlaceExposition, url=slug)
def get_queryset(self):
return self.get_object().exposition_place.all()
def get_context_data(self, **kwargs):
ctx = super(PlaceExpositionListView, self).get_context_data(**kwargs)
ctx['object'] = self.get_object()
return ctx

@ -72,7 +72,7 @@ urlpatterns += solid_i18n_patterns('',
url(r'^sitemap\.xml$', views.index, {'sitemaps': sitemaps}),
url(r'^sitemap-(?P<section>.+)\.xml$', views.sitemap, {'sitemaps': sitemaps}),
url(r'^robots.txt$', Robot.as_view()),
url(r'^$', MainPageView.as_view()),
url(r'^$', MainPageView.as_view(), name='index'),
url(r'^user-agreement/$', TermsofUse.as_view(), name='termsofuse'),
url(r'^page/', include('core.simple_urls')),
url(r'^theme/', include('theme.urls')),

@ -213,7 +213,7 @@
<div class="i-events-list expo-place-events">
<h2 class="sect-title">
{% trans 'Список событий' %}
<a href="#" class="button">{% trans 'Все события' %}</a>
<a href="{% url 'place_exposition_list' object.url %}" class="button">{% trans 'Все события' %}</a>
</h2>
<ul class="cat-list cl-exhibitions">
@ -367,4 +367,4 @@
</script>
{% endblock %}
{% block paginator %}{% endblock %}
{% block paginator %}{% endblock %}

@ -0,0 +1,100 @@
{% extends 'client/base_catalog.html' %}
{% load i18n %}
{% block bread_scrumbs %}
<div class="bread-crumbs">
<a href="{% url 'index' %}">{% trans 'Главная страница' %}</a>
<a href="{{ object.catalog }}">{% trans 'Места' %}</a>
<a href="{{ object.catalog }}country/{{ object.country.url }}/">{{ object.country }}</a>
<a href="{{ object.catalog }}city/{{ object.city.url }}/">{{ object.city }}</a>
<a href="{{ object.get_absolute_url }}">{{ object.name }}</a>
<strong>{% trans 'Все события' %}</strong>
</div>
{% endblock %}
{% block content_list %}
<div class="page-title">
<h1>{% trans 'Все события' %} {{ object.name }}</h1>
</div>
<div class="i-events-list expo-place-events">
<ul class="cat-list cl-exhibitions">
{% for event in object_list %}
<li class="cl-item" data-link="#">
<div class="cl-item-wrap clearfix">
<a href="{{ event.get_permanent_url }}">
{% if event.expohit %}
<span class="hit"></span>
{% endif %}
<div class="cli-pict">
{% with obj=event %}
{% include 'client/includes/show_logo.html' %}
{% endwith %}
</div>
</a>
<div class="cli-info">
<div class="cli-top clearfix">
<header>
<div class="cli-title"><a href="{{ event.get_permanent_url }}">{{ event.name|safe }}</a></div>
</header>
<div class="cli-descr">
{{ event.main_title|safe }}
</div>
</div>
<div class="cli-bot clearfix">
<div class="cli-date">
{% with obj=event %}
{% include 'client/includes/show_date_block.html' %}
{% endwith %}
</div>
<div class="cli-place">
<a href="{{ event.catalog }}country/{{ event.country.url }}/">{{ event.country }}</a>, <a href="{{ event.catalog }}city/{{ event.city.url }}/">{{ event.city }}</a>
</div>
</div>
</div>
<div class="cli-buttons clearfix">
<div class="cli-m-buttons">
<div class="cli-services">
<a class="button icon-sm" href="#">{% trans 'услуги' %}</a>
<div class="cli-services-sm">
<ul>
{% for service in event.get_services %}
<li><a href="{{ service.get_permanent_url }}">{{ service.name }}</a></li>
{% endfor %}
</ul>
</div>
</div>
<a class="button blue icon-calendar" href="{{ event.get_calendar_url }}">{% trans 'в расписание' %}</a>
<a class="button green icon-note" href="#">{% trans 'заметка' %}</a>
</div>
<div class="cli-s-buttons">
<a class="button blue2 lc" target="_blank" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ event.city.id }}">{% trans 'Лучшие цены на отели на' %} <i>Booking</i>.com</a>
</div>
</div>
</div>
<footer class="clearfix">
<div class="cli-stats">
{% if event.visitors %}<span class="visitors"> {{ event.visitors }}</span>{% endif %}
{% if event.members %}<span class="participants">{{ event.members }}</span>{% endif %}
</div>
<div class="cli-tags">
{% include 'client/includes/exposition/tags.html' with obj=event %}
</div>
</footer>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
Loading…
Cancel
Save