t91: удалил услуги у событий

remotes/origin/t90_expo_page
Slava Kyrachevsky 9 years ago
parent b905640121
commit 3824c26670
  1. 24
      apps/conference/models.py
  2. 13
      apps/conference/tests/test_models.py
  3. 14
      apps/exposition/models.py
  4. 32
      apps/functions/model_mixin.py
  5. 1
      apps/place_exposition/views.py
  6. 2
      apps/service/models.py
  7. 2
      apps/service/urls.py
  8. 14
      apps/service/views.py
  9. 1
      templates/client/includes/conference/conference_object.html
  10. 6
      templates/client/includes/conference/conference_partner.html
  11. 13
      templates/client/includes/conference/conference_services.html
  12. 16
      templates/client/includes/event_list.html
  13. 8
      templates/client/includes/exposition/exposition_object.html
  14. 18
      templates/client/includes/exposition/exposition_services.html
  15. 10
      templates/client/includes/exposition/price.html
  16. 10
      templates/client/includes/exposition/programm.html
  17. 6
      templates/client/includes/exposition/services.html
  18. 11
      templates/client/includes/exposition/statistic.html
  19. 2
      templates/client/includes/services.html
  20. 13
      templates/client/place/place_detail.html
  21. 13
      templates/client/place/place_exposition_list.html

@ -146,30 +146,6 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin):
def __unicode__(self): def __unicode__(self):
return self.lazy_translation_getter('name', unicode(self.pk)) return self.lazy_translation_getter('name', unicode(self.pk))
def get_services(self):
return self.get_services_detail()
# country_ids = [item for item, bool in self.country.services if bool==True]
# ids = [item for item, bool in self.services if bool==True]
# qs = Service.objects.filter(Q(Q(url__in=country_ids) & Q(type=Service.type.conference)) | Q(url__in=ids))
# return list(qs)
#return list(Service.objects.language().filter(url__in=ids, type=Service.type.conference).order_by('sort'))
def get_services_detail(self):
# excluded = ['tickets']
return super(Conference, self).get_services_detail(None, Service.type.conference)
# def get_nearest_events(self):
# if self.theme.all():
# theme = self.theme.all()[0]
# now = datetime.datetime.now()
# now = now - datetime.timedelta(days=1)
# conferences = Conference.objects.filter(theme__in=[theme], data_begin__gt=now).exclude(id=self.id).order_by('data_begin')
# return conferences[:3]
# else:
# return []
def get_audience(self): def get_audience(self):
return self.audience.all() return self.audience.all()

@ -1,11 +1,8 @@
import datetime import datetime
from accounts.models import User
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse, NoReverseMatch from django.core.urlresolvers import reverse, NoReverseMatch
from django.test import TestCase from django.test import TestCase
from expobanner.models import Paid, Banner from expobanner.models import Paid, Banner
from service.models import Service
from stats_collector.models import ObjectStats from stats_collector.models import ObjectStats
from theme.models import Tag, Theme from theme.models import Tag, Theme
@ -71,16 +68,6 @@ class ConferenceTest(TestCase):
'name', unicode(self.conference.pk)) 'name', unicode(self.conference.pk))
) )
def test_method_get_services(self):
services = [item for item, bool in self.conference.services if bool]
qs = Service.objects.language()
qs = qs.filter(url__in=services)
self.assertEqual(
sorted(self.conference.get_services(), key=lambda x: x.pk),
sorted(list(qs), key=lambda x: x.pk)
)
def test_method_get_news_url(self): def test_method_get_news_url(self):
self.assertEqual( self.assertEqual(
self.conference.get_news_url(), self.conference.get_news_url(),

@ -5,7 +5,6 @@ from django.contrib.contenttypes import generic
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.db import models from django.db import models
from django.db.models.signals import post_save, pre_save from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from django.utils import translation from django.utils import translation
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from events.models import TargetAudience from events.models import TargetAudience
@ -171,19 +170,6 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin):
def get_price(self): def get_price(self):
return self.price_day or self.price_all return self.price_day or self.price_all
def get_services(self):
return self.get_services_detail()
# country_ids = [item for item, bool in self.country.services if bool==True]
# ids = [item for item, bool in self.services if bool==True]
# qs = Service.objects.language().filter(Q(Q(url__in=country_ids) & Q(type=Service.type.expo)) | Q(url__in=ids))
# return list(qs)
def get_services_detail(self):
excluded = ['visit']
return super(Exposition, self).get_services_detail(excluded, Service.type.expo)
def get_parent(self): def get_parent(self):
return {} return {}

@ -245,38 +245,6 @@ class EventMixin(object):
def cancel(self): def cancel(self):
self.canceled_by_administrator = True self.canceled_by_administrator = True
def get_services(self):
country_ids = [item for item, bool in self.country.services if bool==True]
ids = [item for item, bool in self.services if bool==True and item in country_ids]
return list(Service.objects.language().filter(url__in=ids).order_by('sort'))
def get_services_detail(self, excluded, _type):
if not isinstance(getattr(self, '_get_services_detail', None), list):
# excluded = ['visit', 'tickets']
# country_ids = [item for item, bool in self.country.services if bool==True]
services = [item for item, bool in self.services if bool]
qs = Service.objects.language()
if excluded is not None:
qs = qs.exclude(url__in=excluded)
# qs = qs.filter(Q(Q(url__in=country_ids) & Q(type=_type)) | Q(url__in=ids))
qs = qs.filter(url__in=services)
self._get_services_detail = list(qs)
# import pdb; pdb.set_trace()
#двигаем билеты сразу за переводом
if excluded is None or 'tickets' not in excluded:
translator_idx = tickets = None
for idx, service in enumerate(self._get_services_detail):
if service.url == 'translator':
translator_idx = idx + 1
elif service.url == 'tickets':
tickets = service
if tickets and translator_idx:
self._get_services_detail.remove(tickets)
self._get_services_detail.insert(translator_idx, tickets)
return self._get_services_detail
def duration_days(self, month=None): def duration_days(self, month=None):
if not month: if not month:
d = self.data_end - self.data_begin d = self.data_end - self.data_begin

@ -237,7 +237,6 @@ class PlaceExpositionListView(MetadataMixin, ListView):
места, по ссылке "Все события" места, по ссылке "Все события"
""" """
template_name = 'client/place/place_exposition_list.html' template_name = 'client/place/place_exposition_list.html'
# cache_range = settings.CACHE_RANGE
def get_object(self): def get_object(self):
slug = self.kwargs.get('slug') slug = self.kwargs.get('slug')

@ -6,7 +6,7 @@ from django.db.models.signals import post_save
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from functions.custom_fields import EnumField from functions.custom_fields import EnumField
from functions.signal_handlers import post_save_handler from functions.signal_handlers import post_save_handler
from hvad.models import TranslatableModel, TranslatedFields, TranslationManager from hvad.models import TranslatableModel, TranslatedFields
CURENCIES = ('', 'USD', 'RUB', 'EUR') CURENCIES = ('', 'USD', 'RUB', 'EUR')

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, url
from views import ServiceView, CallBackListView, VisitListView, TranslationListView, AdvertisingListView, \ from views import ServiceView, CallBackListView, VisitListView, TranslationListView, AdvertisingListView, \
ParticipationListView, RemoteListView,TicketsListView, Thanks ParticipationListView, RemoteListView,TicketsListView, Thanks

@ -2,23 +2,17 @@
import json import json
from itertools import chain from itertools import chain
from django.http import HttpResponse
from django.views.generic import ListView, FormView, TemplateView from django.views.generic import ListView, FormView, TemplateView
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.http import Http404
from django.http import HttpResponseRedirect, HttpResponse from django.http import HttpResponseRedirect, HttpResponse
from haystack.query import EmptySearchQuerySet
from meta.views import MetadataMixin from meta.views import MetadataMixin
from accounts.models import UserLog
from exposition.models import Exposition from exposition.models import Exposition
from conference.models import Conference from conference.models import Conference
from functions.custom_views import ExpoListView
from models import Service from models import Service
from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, ParticipationForm, TicketsForm,\ from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, ParticipationForm, TicketsForm,\
AdvertiseForm, BuildStandForm AdvertiseForm, BuildStandForm
#from functions.search_forms import CompanySearchForm from service.models import CallBack, Visit, Translation, Advertising, Participation, Remote, Tickets
order_forms = {'translator': TranslationForm, 'catalog': CatalogForm, 'participation': ParticipationForm, order_forms = {'translator': TranslationForm, 'catalog': CatalogForm, 'participation': ParticipationForm,
@ -121,12 +115,12 @@ def advertise(request, catalog=None, event_url=None):
raise HttpResponse('not ajax') raise HttpResponse('not ajax')
from service.models import CallBack, Visit, Translation, Advertising, Participation, Remote, Tickets
class AbstractOrderListView(ListView): class AbstractOrderListView(ListView):
template_name = 'c_admin/service/order_list.html' template_name = 'c_admin/service/order_list.html'
paginate_by = 20 paginate_by = 20
class CallBackListView(AbstractOrderListView): class CallBackListView(AbstractOrderListView):
model = CallBack model = CallBack
@ -138,15 +132,19 @@ class VisitListView(AbstractOrderListView):
class TranslationListView(AbstractOrderListView): class TranslationListView(AbstractOrderListView):
model = Translation model = Translation
class AdvertisingListView(AbstractOrderListView): class AdvertisingListView(AbstractOrderListView):
model = Advertising model = Advertising
class ParticipationListView(AbstractOrderListView): class ParticipationListView(AbstractOrderListView):
model = Participation model = Participation
class RemoteListView(AbstractOrderListView): class RemoteListView(AbstractOrderListView):
model = Remote model = Remote
class TicketsListView(AbstractOrderListView): class TicketsListView(AbstractOrderListView):
model = Tickets model = Tickets

@ -110,7 +110,6 @@
</div> </div>
</div> </div>
</div> </div>
{% include 'client/includes/conference/conference_services.html' with event=event %}
{% include 'includes/event_steps.html' with event=event %} {% include 'includes/event_steps.html' with event=event %}
{% if event.get_photos %} {% if event.get_photos %}
{% with photos=event.get_photos|slice:"5" %} {% with photos=event.get_photos|slice:"5" %}

@ -87,7 +87,6 @@
{% if event.org %} {% if event.org %}
{% trans 'Организатор' %}: {{ event.org }} {% trans 'Организатор' %}: {{ event.org }}
{% endif %} {% endif %}
<a href="#pw-event-news-subscribe" class="button pw-open new_subribe_btn"><i class="fa fa-at"></i>&nbsp;{% trans 'Подписаться на новости' %}</a>
</div> </div>
</div> </div>
</div> </div>
@ -110,6 +109,7 @@
<a class="button blue icon-photo" href="{{ event.get_permanent_url }}photo/">{% trans 'фото' %}</a> <a class="button blue icon-photo" href="{{ event.get_permanent_url }}photo/">{% trans 'фото' %}</a>
{% endif %} {% endif %}
</div> </div>
<div class="ib-add"><a class="button pw-open blue2" href="#pw-event-news-subscribe"><i class="fa fa-at"></i> {% trans 'Напомнить о выставке' %}</a></div>
</div> </div>
<hr /> <hr />
@ -165,10 +165,6 @@
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{# <p><a href="#pw-event-news-subscribe" class="button pw-open"><i class="fa fa-at"></i>&nbsp;{% trans 'Подписаться на новости' %}</a>&nbsp;&nbsp;&nbsp;<i>{% blocktrans with name=event.name|safe %}Получайте актуальную информацию о концеренции {{ name }} на свой email{% endblocktrans %}</i></p>#}
{# {% include 'client/includes/conference/conference_services.html' with event=event %}#}
{% include 'client/includes/event_steps.html' with event=event %} {% include 'client/includes/event_steps.html' with event=event %}
<hr> <hr>

@ -1,13 +0,0 @@
{% load i18n %}
<div class="i-sub-articles">
<ul>
{% with services=object.get_services_detail %}
{% for service in services %}
<li>
<a href="{{ exposition.get_permanent_url }}service/{{ service.url }}/">{{ service.name }}</a>
</li>
{% endfor %}
{% endwith %}
</ul>
</div>

@ -15,12 +15,12 @@
<div class="hit"></div> <div class="hit"></div>
{% endif %} {% endif %}
{% endif %} {% endif %}
<div class="cli-pict"> <div class="cli-pict">
{% with obj=obj %} {% with obj=obj %}
{% include 'client/includes/show_logo.html' %} {% include 'client/includes/show_logo.html' %}
{% endwith %} {% endwith %}
</div> </div>
</a> </a>
<div class="cli-info"> <div class="cli-info">
<div class="cli-top clearfix"> <div class="cli-top clearfix">
{% if user.is_staff %} {% if user.is_staff %}
@ -68,21 +68,11 @@
<div class="cli-buttons clearfix"> <div class="cli-buttons clearfix">
<div class="cli-m-buttons"> <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 obj.get_services %}
<li><a href="{{ service.get_permanent_url }}">{{ service.name }}</a></li>
{% endfor %}
</ul>
</div>
</div>
{% with event=obj user=user %} {% with event=obj user=user %}
{% include 'client/includes/calendar_button.html' %} {% include 'client/includes/calendar_button.html' %}
{% endwith %} {% endwith %}
<a class="button green icon-note" href="#">{% trans 'заметка' %}</a> <a class="button green icon-note" href="#">{% trans 'заметка' %}</a>
</div> </div>
<div class="cli-s-buttons"> <div class="cli-s-buttons">

@ -91,10 +91,6 @@
</div> </div>
{% endif %} {% endif %}
<div class="event_org">
<a href="#pw-event-news-subscribe" class="button pw-open new_subribe_btn"><i class="fa fa-at"></i>&nbsp;{% trans 'Подписаться на новости' %}</a>
</div>
<hr /> <hr />
<div class="i-buttons clearfix"> <div class="i-buttons clearfix">
@ -112,7 +108,7 @@
<a class="button blue icon-photo" href="{{ exposition.get_permanent_url }}photo/">{% trans 'фото' %}</a> <a class="button blue icon-photo" href="{{ exposition.get_permanent_url }}photo/">{% trans 'фото' %}</a>
{% endif %} {% endif %}
</div> </div>
<div class="ib-add"><a target="_blank" class="button blue2 icon-find" href="http://www.booking.com/searchresults.html?aid={{ book_aid }}&city={{ object.city.id }}">{% trans 'Найти отель' %}</a></div> <div class="ib-add"><a class="button pw-open blue2" href="#pw-event-news-subscribe"><i class="fa fa-at"></i> {% trans 'Напомнить о выставке' %}</a></div>
</div> </div>
<hr /> <hr />
@ -138,8 +134,6 @@
</div> </div>
</div> </div>
{% include 'client/includes/exposition/exposition_services.html' with object=exposition %}
{% include 'client/includes/event_steps.html' with event=exposition %} {% include 'client/includes/event_steps.html' with event=exposition %}
{% if exposition.get_photos %} {% if exposition.get_photos %}

@ -1,18 +0,0 @@
{% load i18n %}
<div class="i-sub-articles">
<ul>
{% with services=object.get_services_detail %}
{% for service in services %}
<li>
{# временно создаём условие, т.к. для переводчиков подключаем партнёров #}
{% if service.name == 'Переводчик' %}
<a href="https://www.interpreters.travel/ru/new_partner_search?partner_id=44&search[city_name]={{ object.place.city }}&search_date={{ object.data_begin|date:'Y-m-d' }}" target="_blank">{{ service.name }}</a>
{% else %}
<a href="{{ exposition.get_permanent_url }}service/{{ service.url }}/">{{ service.name }}</a>
{% endif %}
</li>
{% endfor %}
{% endwith %}
</ul>
</div>

@ -257,13 +257,3 @@
<div class="ed-back"> <div class="ed-back">
<a href="{{ exposition.get_permanent_url }}">{{ exposition.name|safe }}</a> <a href="{{ exposition.get_permanent_url }}">{{ exposition.name|safe }}</a>
</div> </div>
<div class="i-sub-articles">
<ul>
{% with services=exposition.get_services %}
{% for service in services %}
<li><a href="{{ exposition.get_permanent_url }}service/{{ service.url }}/">{{ service.name }}</a></li>
{% endfor %}
{% endwith %}
</ul>
</div>

@ -130,13 +130,3 @@
<div class="ed-back"> <div class="ed-back">
<a href="{{ exposition.get_permanent_url }}">{{ exposition.name|safe }}</a> <a href="{{ exposition.get_permanent_url }}">{{ exposition.name|safe }}</a>
</div> </div>
<div class="i-sub-articles">
<ul>
{% with services=exposition.get_services %}
{% for service in services %}
<li><a href="{{ exposition.get_permanent_url }}service/{{ service.url }}/">{{ service.name }}</a></li>
{% endfor %}
{% endwith %}
</ul>
</div>

@ -15,12 +15,6 @@
{% elif obj.partner %} {% elif obj.partner %}
<li><a target="_blank" href="{{ obj.web_page }}">{% trans 'Официальный сайт' %}</a></li> <li><a target="_blank" href="{{ obj.web_page }}">{% trans 'Официальный сайт' %}</a></li>
<li><a target="_blank" href="{{ obj.link }}">{% trans 'Билеты' %}</a></li> <li><a target="_blank" href="{{ obj.link }}">{% trans 'Билеты' %}</a></li>
{% else %}
{% with services=obj.get_services %}
{% for service in services %}
<li><a href="{{ obj.get_permanent_url }}service/{{ service.url }}/">{{ service.name }}</a></li>
{% endfor %}
{% endwith %}
{% endif %} {% endif %}
</ul> </ul>
</div> </div>

@ -154,14 +154,3 @@
<div class="ed-back"> <div class="ed-back">
<a href="{{ exposition.get_permanent_url }}">{{ exposition.name|safe }}</a> <a href="{{ exposition.get_permanent_url }}">{{ exposition.name|safe }}</a>
</div> </div>
<div class="i-sub-articles">
<ul>
{% with services=exposition.get_services %}
{% for service in services %}
<li><a href="{{ exposition.get_permanent_url }}service/{{ service.url }}/">{{ service.name }}</a></li>
{% endfor %}
{% endwith %}
</ul>
</div>

@ -4,7 +4,7 @@
<nav> <nav>
<ul> <ul>
<li><a href="/advertising/">{% trans 'Продвижение событий' %}</a></li> <li><a href="/advertising/">{% trans 'Продвижение событий' %}</a></li>
<li><a href="/service/participation/">{% trans 'Участие в выставках' %}</a></li> <li><a href="/service/participation/">{% trans 'Организация участия в выставках' %}</a></li>
</ul> </ul>
</nav> </nav>
</div> </div>

@ -260,20 +260,7 @@
<div class="cli-buttons clearfix"> <div class="cli-buttons clearfix">
<div class="cli-m-buttons"> <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 blue icon-calendar" href="{{ event.get_calendar_url }}">{% trans 'в расписание' %}</a>
<a class="button green icon-note" href="#">{% trans 'заметка' %}</a>
</div> </div>
<div class="cli-s-buttons"> <div class="cli-s-buttons">

@ -60,20 +60,7 @@
<div class="cli-buttons clearfix"> <div class="cli-buttons clearfix">
<div class="cli-m-buttons"> <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 blue icon-calendar" href="{{ event.get_calendar_url }}">{% trans 'в расписание' %}</a>
<a class="button green icon-note" href="#">{% trans 'заметка' %}</a>
</div> </div>
<div class="cli-s-buttons"> <div class="cli-s-buttons">

Loading…
Cancel
Save