parent
ad3974c9b8
commit
f41b72eac5
30 changed files with 1308 additions and 53 deletions
@ -0,0 +1,7 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from django.conf.urls import patterns, url |
||||||
|
from views import CityView |
||||||
|
|
||||||
|
urlpatterns = patterns('', |
||||||
|
url(r'(?P<slug>.*)', CityView.as_view()), |
||||||
|
) |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
from django.views.generic import DetailView |
||||||
|
from models import City |
||||||
|
|
||||||
|
|
||||||
|
class CityView(DetailView): |
||||||
|
model = City |
||||||
|
slug_field = 'url' |
||||||
|
template_name = 'city/city.html' |
||||||
@ -0,0 +1 @@ |
|||||||
|
__author__ = 'kotzilla' |
||||||
@ -0,0 +1 @@ |
|||||||
|
__author__ = 'kotzilla' |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
import MySQLdb |
||||||
|
from MySQLdb.cursors import DictCursor |
||||||
|
from django.core.management.base import BaseCommand, CommandError |
||||||
|
from country.models import Country |
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand): |
||||||
|
def handle(self, *args, **options): |
||||||
|
# local database(will not work on production) |
||||||
|
db = MySQLdb.connect(host="localhost", |
||||||
|
user="root", |
||||||
|
passwd="qazedc", |
||||||
|
db="test", |
||||||
|
charset='utf8', |
||||||
|
cursorclass=DictCursor) |
||||||
|
cursor = db.cursor() |
||||||
|
# !!!database can change |
||||||
|
sql = "SELECT country_code as code, geo_lat as latitude, geo_lng as longitude FROM test.country_country LEFT JOIN localization.meta_location ON test.country_country.country_code=localization.meta_location.iso COLLATE utf8_unicode_ci WHERE localization.meta_location.type='CO' AND geo_lat IS NOT NULL;" |
||||||
|
cursor.execute(sql) |
||||||
|
result = cursor.fetchall() |
||||||
|
for item in result: |
||||||
|
updates = Country.objects.filter(country_code=item['code']).update(latitude=item['latitude'], longitude=item['longitude']) |
||||||
|
if updates: |
||||||
|
print(item['code']) |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from django.conf.urls import patterns, url |
||||||
|
from views import CountryView |
||||||
|
|
||||||
|
|
||||||
|
urlpatterns = patterns('', |
||||||
|
url(r'(?P<slug>.*)', CountryView.as_view()), |
||||||
|
) |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
from django.views.generic import DetailView |
||||||
|
from models import Country |
||||||
|
|
||||||
|
|
||||||
|
class CountryView(DetailView): |
||||||
|
model = Country |
||||||
|
slug_field = 'url' |
||||||
|
template_name = 'country/country.html' |
||||||
@ -0,0 +1 @@ |
|||||||
|
__author__ = 'kotzilla' |
||||||
@ -0,0 +1 @@ |
|||||||
|
__author__ = 'kotzilla' |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
import MySQLdb |
||||||
|
from MySQLdb.cursors import DictCursor |
||||||
|
from django.core.management.base import BaseCommand, CommandError |
||||||
|
from directories.models import Currency |
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand): |
||||||
|
def handle(self, *args, **options): |
||||||
|
# local database(will not work on production) |
||||||
|
db = MySQLdb.connect(host="localhost", |
||||||
|
user="root", |
||||||
|
passwd="qazedc", |
||||||
|
db="test", |
||||||
|
charset='utf8', |
||||||
|
cursorclass=DictCursor) |
||||||
|
cursor = db.cursor() |
||||||
|
# !!!database can change |
||||||
|
sql = "SELECT code, name FROM localization.currencies;" |
||||||
|
cursor.execute(sql) |
||||||
|
result = cursor.fetchall() |
||||||
|
for item in result: |
||||||
|
try: |
||||||
|
currency = Currency.objects.get(code=item['code']) |
||||||
|
print('currency with code %s already exist'%currency.code) |
||||||
|
continue |
||||||
|
except Currency.DoesNotExist: |
||||||
|
currency = Currency(code=item['code']) |
||||||
|
|
||||||
|
currency.translate('ru') |
||||||
|
currency.name = item['name'] |
||||||
|
currency.save() |
||||||
|
currency.translate('en') |
||||||
|
currency.name = item['name'] |
||||||
|
currency.save() |
||||||
|
print(currency.code) |
||||||
@ -0,0 +1,144 @@ |
|||||||
|
{% extends 'base_catalog.html' %} |
||||||
|
{% load static %} |
||||||
|
{% load i18n %} |
||||||
|
|
||||||
|
{% block bread_scrumbs %} |
||||||
|
<div class="bread-crumbs"> |
||||||
|
<a href="/">{% trans 'Главная страница' %}</a> |
||||||
|
<strong>{{ object.name }}</strong> |
||||||
|
</div> |
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block page_title %} |
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block content_list %} |
||||||
|
<div class="m-article"> |
||||||
|
<div class="item-wrap place clearfix"> |
||||||
|
<aside> |
||||||
|
<div class="i-pict"> |
||||||
|
{% include 'client/includes/show_logo.html' with obj=object %} |
||||||
|
</div> |
||||||
|
</aside> |
||||||
|
|
||||||
|
<div class="i-info"> |
||||||
|
<header> |
||||||
|
<div class="i-title">{{ object.name }}</div> |
||||||
|
</header> |
||||||
|
|
||||||
|
<table class="country_table"> |
||||||
|
<tr> |
||||||
|
<td> |
||||||
|
<ul> |
||||||
|
{% if object.population %} |
||||||
|
<li><strong>{% trans 'Население' %}:</strong><span>{{ object.population }} {% trans 'человек' %}</span></li> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% if object.code_IATA %} |
||||||
|
<li>Код IATA:<span>{{ object.code_IATA.code }}</span></li> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% if object.phone_code %} |
||||||
|
<li>{% trans 'Телефонный код' %}:<span>+{{ object.phone_code }}</span></li> |
||||||
|
{% endif %} |
||||||
|
{% if object.transport %} |
||||||
|
<li><i>{% trans 'Транспорт' %}:</i><span>{{ object.transport }}</span></li> |
||||||
|
{% endif %} |
||||||
|
</ul> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
|
||||||
|
<div class="i-address map-opened country_map"> |
||||||
|
|
||||||
|
<div class="i-map"> |
||||||
|
<!-- позиция для карты задается в атрибуте data-coords --> |
||||||
|
<div class="map-canvas" id="map-canvas" data-coords="{{ object.latitude|stringformat:'f' }},{{ object.longitude|stringformat:'f' }}" ></div> |
||||||
|
<div class="close-map"><a class="toggle-map" href="#">{% trans 'Скрыть карту' %}</a></div> |
||||||
|
</div> |
||||||
|
<header> |
||||||
|
<div class="show-map show-map_1"><a class="toggle-map" href="#">{% trans 'Раскрыть карту' %}</a></div> |
||||||
|
</header> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<table class="map_info_block"> |
||||||
|
{% if object.famous_places %} |
||||||
|
<tr> |
||||||
|
<th>{% trans 'Должны посетить' %}:</th> |
||||||
|
<td class="width_1"> |
||||||
|
{{ object.famous_places }} |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
{% endif %} |
||||||
|
{% if object.shoping %} |
||||||
|
<tr> |
||||||
|
<th>{% trans 'Шоппинг' %}:</th> |
||||||
|
<td class="width_1"> |
||||||
|
{{ object.shoping }} |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
{% endif %} |
||||||
|
</table> |
||||||
|
|
||||||
|
{% if object.description %} |
||||||
|
<hr /> |
||||||
|
<div class="i-services country_content"> |
||||||
|
<div class="sect-title">Описание</div> |
||||||
|
<div class="i-descr"> |
||||||
|
{{ object.description }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% if object.get_photos %} |
||||||
|
<div class="i-photo-slides i-photo-slides_1"> |
||||||
|
<div class="sect-title">Фотогалерея</div> |
||||||
|
<div id="ps-photo-gallery" class="ps-photo-gallery swiper-container"> |
||||||
|
<ul class="swiper-wrapper"> |
||||||
|
|
||||||
|
<li class="swiper-slide"><img src="img/_del-temp/place-photo-1.jpg" alt="" /></li> |
||||||
|
<li class="swiper-slide"><img src="img/_del-temp/event-photo-1.jpg" alt="" /></li> |
||||||
|
|
||||||
|
</ul> |
||||||
|
<div class="re-controls"> |
||||||
|
<a class="prev" href="#"><</a> |
||||||
|
<a class="next" href="#">></a> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
</div> |
||||||
|
|
||||||
|
{% if object.get_events %} |
||||||
|
<br> |
||||||
|
<div class="i-events-list"> |
||||||
|
<div class="sect-title blog_link"> |
||||||
|
<a href="#" title="">{% trans 'События в' %} {{ object.name }}</a><a class="button more" href="{{ object.events_catalog }}">{% trans 'Все события' %}</a> |
||||||
|
</div> |
||||||
|
{% include 'includes/exposition/exposition_list.html' with object_list=object.get_events %} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% if object.get_places %} |
||||||
|
<br> |
||||||
|
<div class="i-events-list"> |
||||||
|
<div class="sect-title blog_link"> |
||||||
|
<a href="#" title="">{% trans 'Места в' %} {{ object.name }}</a><a class="button more" href="{{ object.places_catalog }}">{% trans 'Все места' %}</a> |
||||||
|
</div> |
||||||
|
{% include 'includes/place/place_list.html' with object_list=object.get_places %} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% if object.get_organisers %} |
||||||
|
<br> |
||||||
|
<div class="i-events-list"> |
||||||
|
<div class="sect-title blog_link"> |
||||||
|
<a href="#" title="">{% trans 'Организаторы в' %} {{ object.name }}</a><a class="button more" href="#">{% trans 'Все организаторы' %} </a> |
||||||
|
</div> |
||||||
|
{% include 'includes/organiser/organiser_list.html' with object_list=object.get_organisers %} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% endblock %} |
||||||
@ -0,0 +1,181 @@ |
|||||||
|
{% extends 'base_catalog.html' %} |
||||||
|
{% load static %} |
||||||
|
{% load i18n %} |
||||||
|
|
||||||
|
{% block bread_scrumbs %} |
||||||
|
<div class="bread-crumbs"> |
||||||
|
<a href="/">{% trans 'Главная страница' %}</a> |
||||||
|
<strong>{{ object.name }}</strong> |
||||||
|
</div> |
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block page_title %} |
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block content_list %} |
||||||
|
<div class="m-article"> |
||||||
|
<div class="item-wrap place clearfix"> |
||||||
|
<aside> |
||||||
|
<div class="i-pict"> |
||||||
|
{% include 'client/includes/show_logo.html' with obj=object %} |
||||||
|
</div> |
||||||
|
</aside> |
||||||
|
<div class="i-info"> |
||||||
|
<header> |
||||||
|
<div class="i-title">{{ object.name }}</div> |
||||||
|
</header> |
||||||
|
<table class="country_table"> |
||||||
|
<tr> |
||||||
|
<td> |
||||||
|
<ul> |
||||||
|
{% if object.capital %} |
||||||
|
<li><strong>{% trans 'Столица' %}:</strong><span><a href="/city/{{ object.capital.url }}" title="">{{ object.capital.name }}</a></span></li> |
||||||
|
{% endif %} |
||||||
|
{% if object.language.all %} |
||||||
|
<li>{% trans 'Официальный язык' %}: |
||||||
|
{% for lang in object.language.all %} |
||||||
|
<span>{{ lang.name }}</span> |
||||||
|
{% endfor %} |
||||||
|
</li> |
||||||
|
{% endif %} |
||||||
|
{% if object.timezone %} |
||||||
|
<li>{% trans 'Часовая зона' %}:<span>{{ object.timezone }}</span></li> |
||||||
|
<li>{% trans 'Часовые пояса' %}:<span>среднее время по Гринвичу</span></li> |
||||||
|
{% endif %} |
||||||
|
</ul> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<ul> |
||||||
|
{% if object.population %} |
||||||
|
<li>{% trans 'Население' %}:<span>{{ object.population }} {% trans 'человек' %}</span></li> |
||||||
|
{% endif %} |
||||||
|
{% if object.phone_code %} |
||||||
|
<li>{% trans 'Телефонный код' %}:<span>+ {{ object.phone_code }}</span></li> |
||||||
|
{% endif %} |
||||||
|
{% if object.currency.all %} |
||||||
|
<li>{% trans 'Валюта' %}: |
||||||
|
{% for currency in object.currency.all %} |
||||||
|
<span>{{ currency.code }}</span> |
||||||
|
{% endfor %} |
||||||
|
{% endif %} |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
{% if object.latitude %} |
||||||
|
<div class="i-address map-opened country_map"> |
||||||
|
|
||||||
|
<div class="i-map"> |
||||||
|
<!-- позиция для карты задается в атрибуте data-coords --> |
||||||
|
<div class="map-canvas" id="map-canvas" data-coords="{{ object.latitude|stringformat:'f' }},{{ object.longitude|stringformat:'f' }}" ></div> |
||||||
|
<div class="close-map"><a class="toggle-map" href="#">{% trans 'Скрыть карту' %}</a></div> |
||||||
|
</div> |
||||||
|
<header> |
||||||
|
<div class="show-map show-map_1"><a class="toggle-map" href="#">{% trans 'Раскрыть карту' %}</a></div> |
||||||
|
</header> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
</div> |
||||||
|
{% if object.big_cities.all %} |
||||||
|
<div class="country_towns"> |
||||||
|
<h4>{% trans 'Крупные города' %}:</h4> |
||||||
|
<table> |
||||||
|
<tr> |
||||||
|
<td> |
||||||
|
<ul> |
||||||
|
{% for city in object.big_cities.all %} |
||||||
|
<li><a href="#" title="">{{ city.name }}</a></li> |
||||||
|
{% endfor %} |
||||||
|
</ul> |
||||||
|
</td> |
||||||
|
<th> </th> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
<hr /> |
||||||
|
{% if object.description %} |
||||||
|
<div class="i-services country_content"> |
||||||
|
<div class="sect-title">{% trans 'Описание' %}</div> |
||||||
|
<div class="i-descr"> |
||||||
|
{{ object.description }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
{% if object.get_photos %} |
||||||
|
<div class="i-photo-slides"> |
||||||
|
<div class="sect-title">{% trans 'Фотогалерея' %}</div> |
||||||
|
<div id="ps-photo-gallery" class="ps-photo-gallery swiper-container"> |
||||||
|
<ul class="swiper-wrapper"> |
||||||
|
|
||||||
|
<li class="swiper-slide"><img src="img/_del-temp/place-photo-1.jpg" alt="" /></li> |
||||||
|
<li class="swiper-slide"><img src="img/_del-temp/event-photo-1.jpg" alt="" /></li> |
||||||
|
|
||||||
|
</ul> |
||||||
|
<div class="re-controls"> |
||||||
|
<a class="prev" href="#"><</a> |
||||||
|
<a class="next" href="#">></a> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<hr> |
||||||
|
{% endif %} |
||||||
|
{% if object.rules %} |
||||||
|
<div class="i-services country_content"> |
||||||
|
<div class="sect-title">{% trans 'Визовая информация' %}</div> |
||||||
|
<div class="i-descr"> |
||||||
|
{{ object.rules }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
{% if object.documents or object.consulate %} |
||||||
|
<table class="country_content_table"> |
||||||
|
<tr> |
||||||
|
<td> |
||||||
|
<h4>{% trans 'Документы' %}</h4> |
||||||
|
<ul> |
||||||
|
{{ object.documents }} |
||||||
|
</ul> |
||||||
|
</td> |
||||||
|
<td class="delimiter"> </td> |
||||||
|
<th> |
||||||
|
{{ object.consulate }} |
||||||
|
</th> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
{% endif %} |
||||||
|
</div> |
||||||
|
{% if object.get_events %} |
||||||
|
<br> |
||||||
|
|
||||||
|
<div class="i-events-list"> |
||||||
|
<div class="sect-title blog_link"> |
||||||
|
<a href="#" title="">{% trans 'События в' %} {{ object.name }}</a><a class="button more" href="{{ object.events_catalog }}">{% trans 'Все события' %}</a> |
||||||
|
</div> |
||||||
|
{% include 'includes/exposition/exposition_list.html' with object_list=object.get_events %} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% if object.get_places %} |
||||||
|
<br> |
||||||
|
<div class="i-events-list"> |
||||||
|
<div class="sect-title blog_link"> |
||||||
|
<a href="#" title="">{% trans 'Места в' %} {{ object.name }}</a><a class="button more" href="{{ object.places_catalog }}">{% trans 'Все места' %}</a> |
||||||
|
</div> |
||||||
|
{% include 'includes/place/place_list.html' with object_list=object.get_places %} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% if object.get_organisers %} |
||||||
|
<br> |
||||||
|
<div class="i-events-list"> |
||||||
|
<div class="sect-title blog_link"> |
||||||
|
<a href="#" title="">{% trans 'Организаторы в' %} {{ object.name }}</a><a class="button more" href="#">{% trans 'Все организаторы' %} </a> |
||||||
|
</div> |
||||||
|
{% include 'includes/organiser/organiser_list.html' with object_list=object.get_organisers %} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
{% endblock %} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<table class="parnters_about_block_table"> |
||||||
|
<tr> |
||||||
|
{% for organiser in object_list %} |
||||||
|
<td> |
||||||
|
<a href="#"> |
||||||
|
<span class="imp-pict"> |
||||||
|
{% include 'client/includes/show_logo.html' with obj=organiser %} |
||||||
|
</span> |
||||||
|
{{ organiser.name }} |
||||||
|
</a> |
||||||
|
</td> |
||||||
|
<td class="delimiter"> </td> |
||||||
|
{% endfor %} |
||||||
|
</tr> |
||||||
|
</table> |
||||||
Loading…
Reference in new issue