From 647bfd927b859c5714cb2cbd02ce79f4201de649 Mon Sep 17 00:00:00 2001 From: Alexander Burdeiny Date: Mon, 27 Jun 2016 11:35:22 +0300 Subject: [PATCH 1/3] =?UTF-8?q?1374:=20=D0=AD=D1=82=D0=B0=D0=BF=20?= =?UTF-8?q?=E2=84=964=20-=20=D0=A3=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9?= =?UTF-8?q?=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5=D0=B9=20?= =?UTF-8?q?=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B6=D0=BE=D1=81=D1=82=D0=BA=D0=BE=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D0=BE=20=D0=B2=D1=8B=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D0=BA=D0=B8=20=D1=82=D0=B5=D0=BC=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D1=83=D1=8E=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=86=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proj/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proj/views.py b/proj/views.py index b0a1af87..e0b82252 100644 --- a/proj/views.py +++ b/proj/views.py @@ -86,8 +86,8 @@ class MainPageView(JitterCacheMixin, TemplateView): # update main_page counter for event in events: event.main.link.log(self.request, 1) - exposition_themes = Theme.objects.language().order_by('-main_page').filter(types=Theme.types.exposition)[:6] - conference_themes = Theme.objects.language().order_by('-main_page').filter(types=Theme.types.conference)[:6] + exposition_themes = Theme.objects.language().filter(main_page=True).order_by('-main_page').filter(types=Theme.types.exposition)[:6] + conference_themes = Theme.objects.language().filter(main_page=True).order_by('-main_page').filter(types=Theme.types.conference)[:6] args = {'events': events, 'exposition_themes': exposition_themes, 'conference_themes': conference_themes, 'search_form': ExpositionSearchForm, 'search_action': '/expo/search/', From 3884abb4afd34ef72eb6f5326c57edd684ba6050 Mon Sep 17 00:00:00 2001 From: Alexander Burdeiny Date: Mon, 27 Jun 2016 12:22:49 +0300 Subject: [PATCH 2/3] =?UTF-8?q?1380:=20=D0=AD=D1=82=D0=B0=D0=BF=20?= =?UTF-8?q?=E2=84=964=20-=20=D0=9F=D1=83=D1=81=D1=82=D0=B0=D1=8F=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BC=D0=B0=D1=82=D0=B8=D0=BA=D0=B0=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=B5=D1=80=D0=B5=D0=BD=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conference/admin.py | 5 ++ conference/admin_urls.py | 7 +- exposition/admin.py | 5 ++ exposition/admin_urls.py | 6 +- functions/admin_views.py | 30 +++++++-- proj/views.py | 4 +- settings/admin.py | 4 +- .../admin/conference/conference_list.html | 23 +++++-- templates/admin/expobanner/comment_list.html | 2 +- templates/admin/expobanner/pcomment_list.html | 2 +- .../admin/exposition/exposition_list.html | 24 +++++-- .../place_conference_list.html | 23 ++++--- templates/admin/redirects/list.html | 2 +- .../conference/conference_object.html | 67 ++++++++++--------- .../includes/conference/conference_paid.html | 8 ++- .../client/includes/exposition/expo_paid.html | 13 ++-- .../exposition/exposition_object.html | 67 ++++++++++--------- 17 files changed, 187 insertions(+), 105 deletions(-) diff --git a/conference/admin.py b/conference/admin.py index fdbea666..ab127900 100644 --- a/conference/admin.py +++ b/conference/admin.py @@ -26,6 +26,7 @@ from forms import ( ) from functions.admin_views import ( AdminListView, + AdminListViewNoThemeMixin, AdminView, stat_paginate_results, upload_photo @@ -310,6 +311,10 @@ class ConferenceListView(AdminListView): model = Conference +class ConferenceListViewNoTheme(AdminListViewNoThemeMixin, ConferenceListView): + pass + + def upload_conference_photo(request, conf_id): return upload_photo(request, conf_id, Conference) diff --git a/conference/admin_urls.py b/conference/admin_urls.py index 5abc9dd7..fa50ee56 100644 --- a/conference/admin_urls.py +++ b/conference/admin_urls.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- from django.conf.urls import patterns, include, url -from admin import ConferenceListView, ConferenceView +from admin import ConferenceListView, ConferenceView, ConferenceListViewNoTheme urlpatterns = patterns('conference.admin', url(r'^upload-photo/(?P.*)/$', 'upload_conference_photo'), url(r'^delete/(?P.*)$', 'conference_delete'), url(r'^copy/$', 'conf_copy'), - url(r'^all/$', ConferenceListView.as_view()), + url(r'^all/$', ConferenceListView.as_view(), name='admin-conference-all'), + url(r'^notheme/$', ConferenceListViewNoTheme.as_view(), name='admin-conference-notheme'), #url(r'^change/(?P.*)/$', 'conference_change'), url(r'^switch/(?P.*)/(?P.*)$', 'conference_switch'), @@ -14,4 +15,4 @@ urlpatterns = patterns('conference.admin', url(r'^(?P.*)/$', ConferenceView.as_view()), url(r'^$', ConferenceView.as_view()), -) \ No newline at end of file +) diff --git a/exposition/admin.py b/exposition/admin.py index 971fcd62..d16e63f2 100644 --- a/exposition/admin.py +++ b/exposition/admin.py @@ -24,6 +24,7 @@ from forms import ( ) from functions.admin_views import ( AdminListView, + AdminListViewNoThemeMixin, AdminView, stat_paginate_results, upload_photo @@ -349,6 +350,10 @@ class ExpositionListView(AdminListView): model = Exposition +class ExpositionListViewNoTheme(AdminListViewNoThemeMixin, ExpositionListView): + pass + + def upload_exposition_photo(request, expo_id): return upload_photo(request, expo_id, Exposition) diff --git a/exposition/admin_urls.py b/exposition/admin_urls.py index 9adda27b..1ffcc9d2 100644 --- a/exposition/admin_urls.py +++ b/exposition/admin_urls.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from django.conf.urls import patterns, include, url -from admin import ExpositionListView, ExpositionView +from admin import ExpositionListView, ExpositionView, ExpositionListViewNoTheme urlpatterns = patterns('exposition.admin', url(r'^upload-photo/(?P.*)/$', 'upload_exposition_photo'), @@ -9,7 +9,9 @@ urlpatterns = patterns('exposition.admin', #url(r'^add.*/$', 'exposition_add'), url(r'^delete/(?P.*)/$', 'exposition_delete'), #url(r'^change/(?P.*)/$', 'exposition_change'), - url(r'^all/$', ExpositionListView.as_view()), + url(r'^all/$', ExpositionListView.as_view(), name='admin-exposition-all'), + url(r'^notheme/$', ExpositionListViewNoTheme.as_view(), name='admin-exposition-notheme'), + url(r'^switch/(?P.*)/(?P.*)$', 'exposition_switch'), #url(r'^copy/(?P.*)$', 'exposition_copy'), url(r'^search/$', 'search_expo'), diff --git a/functions/admin_views.py b/functions/admin_views.py index a4ef8305..28f2199b 100644 --- a/functions/admin_views.py +++ b/functions/admin_views.py @@ -131,16 +131,38 @@ class AdminListView(FormView): context.update({'object_list': result}) return self.render_to_response(context) - def get_context_data(self, **kwargs): - context = super(AdminListView, self).get_context_data(**kwargs) + def get_queryset(self): if issubclass(self.model, TranslatableModel): - qs = self.model.objects.language().all().order_by('name') + return self.model.objects.language().all().order_by('name') else: - qs = self.model.objects.all().order_by('-modified') + return self.model.objects.all().order_by('-modified') + + def get_context_data(self, **kwargs): + context = super(AdminListView, self).get_context_data(**kwargs) + qs = self.get_queryset() result = self.paginate_func(qs, page=self.request.GET.get('page')) context['object_list'] = result return context + +class AdminListViewNoThemeMixin(object): + def get_queryset(self): + return self.model.objects.language().filter(theme__isnull=True).order_by('name') + + def form_valid(self, form): + qs = form.filter() + qs = qs.filter(theme__isnull=True) + result = self.paginate_func(qs, page=self.request.GET.get('page')) + context = self.get_context_data(form=form) + context.update({'object_list': result}) + return self.render_to_response(context) + + def get_context_data(self, **kwargs): + context = super(AdminListViewNoThemeMixin, self).get_context_data(**kwargs) + context.update({'notheme': True}) + return context + + def upload_photo(request, id, Model): """ uploading photo to some instance of Model diff --git a/proj/views.py b/proj/views.py index e0b82252..5b987c26 100644 --- a/proj/views.py +++ b/proj/views.py @@ -86,8 +86,8 @@ class MainPageView(JitterCacheMixin, TemplateView): # update main_page counter for event in events: event.main.link.log(self.request, 1) - exposition_themes = Theme.objects.language().filter(main_page=True).order_by('-main_page').filter(types=Theme.types.exposition)[:6] - conference_themes = Theme.objects.language().filter(main_page=True).order_by('-main_page').filter(types=Theme.types.conference)[:6] + exposition_themes = Theme.objects.language().filter(main_page=True, types=Theme.types.exposition)[:6] + conference_themes = Theme.objects.language().filter(main_page=True, types=Theme.types.conference)[:6] args = {'events': events, 'exposition_themes': exposition_themes, 'conference_themes': conference_themes, 'search_form': ExpositionSearchForm, 'search_action': '/expo/search/', diff --git a/settings/admin.py b/settings/admin.py index 9414d003..d6c0aba5 100644 --- a/settings/admin.py +++ b/settings/admin.py @@ -46,8 +46,8 @@ def main_page(request): news_form.fields['main_page_news'].widget.attrs['data-init-text'] = json.dumps(a) article_form = MainPageArticle(initial={'article' : blogs}) - args = { 'theme_form' : MainPageThemes(initial=themes), + args = {'theme_form' : MainPageThemes(initial=themes), 'article_form' : article_form, 'news_form' : news_form} args.update(csrf(request)) - return render_to_response('admin/settings/main_page.html', args) \ No newline at end of file + return render_to_response('admin/settings/main_page.html', args) diff --git a/templates/admin/conference/conference_list.html b/templates/admin/conference/conference_list.html index 76c43f35..25454b13 100644 --- a/templates/admin/conference/conference_list.html +++ b/templates/admin/conference/conference_list.html @@ -20,12 +20,25 @@ td a{

{% trans "Фильтры" %}

-
-
- {{ form }} - -
+
+
+
+ {{ form }} + + +
+
+
+ +
diff --git a/templates/admin/expobanner/comment_list.html b/templates/admin/expobanner/comment_list.html index d13c5ded..4e3fa6e0 100644 --- a/templates/admin/expobanner/comment_list.html +++ b/templates/admin/expobanner/comment_list.html @@ -32,6 +32,6 @@ {% endblock %} {# pagination #} - {% include 'admin/includes/admin_pagination.html' with page_obj=page_obj %} + {% include 'admin/includes/admin_pagination.html' with page_obj=object_list %} {% endblock %} diff --git a/templates/admin/expobanner/pcomment_list.html b/templates/admin/expobanner/pcomment_list.html index a59cbc93..310ea791 100644 --- a/templates/admin/expobanner/pcomment_list.html +++ b/templates/admin/expobanner/pcomment_list.html @@ -32,6 +32,6 @@ {% endblock %} {# pagination #} - {% include 'admin/includes/admin_pagination.html' with page_obj=page_obj %} + {% include 'admin/includes/admin_pagination.html' with page_obj=object_list %} {% endblock %} diff --git a/templates/admin/exposition/exposition_list.html b/templates/admin/exposition/exposition_list.html index a90a9561..bf1c6391 100644 --- a/templates/admin/exposition/exposition_list.html +++ b/templates/admin/exposition/exposition_list.html @@ -19,15 +19,29 @@ td a{

{% trans "Фильтры" %}

-
-
- {{ form }} - -
+
+
+
+ {{ form }} + + +
+
+
+ +
+

{% trans "Список выставок" %}

diff --git a/templates/admin/place_conference/place_conference_list.html b/templates/admin/place_conference/place_conference_list.html index b3f656ac..11df2ff8 100644 --- a/templates/admin/place_conference/place_conference_list.html +++ b/templates/admin/place_conference/place_conference_list.html @@ -1,16 +1,17 @@ {% extends 'admin_list.html' %} +{% load i18n %} {% block body %}
-

Фильтры

+

{% trans "Фильтры" %}

{{ form }} - +
@@ -18,16 +19,16 @@
-

Места проведения конференций

+

{% trans "Места проведения конференций" %}

- - - + + + @@ -39,27 +40,27 @@ {% endfor %}
НазваниеСтранаГород{% trans "Название" %}{% trans "Страна" %}{% trans "Город" %}  
{% ifnotequal item.city None %}{{ item.city }} {% endifnotequal %} - Изменить + {% trans "Изменить" %} - Копировать + {% trans "Копировать" %} - Удалить + {% trans "Удалить" %}
- Добавить конферец зал + {% trans "Добавить конферец зал" %}
{# pagination #} {% include 'admin/includes/admin_pagination.html' with page_obj=object_list %}
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/admin/redirects/list.html b/templates/admin/redirects/list.html index c48d2ff9..5f845ad9 100644 --- a/templates/admin/redirects/list.html +++ b/templates/admin/redirects/list.html @@ -32,6 +32,6 @@ {% endblock %}
{# pagination #} - {% include 'admin/includes/admin_pagination.html' with page_obj=page_obj %} + {% include 'admin/includes/admin_pagination.html' with page_obj=object_list %}
{% endblock %} diff --git a/templates/client/includes/conference/conference_object.html b/templates/client/includes/conference/conference_object.html index 2d6e10e2..07691a09 100644 --- a/templates/client/includes/conference/conference_object.html +++ b/templates/client/includes/conference/conference_object.html @@ -353,46 +353,53 @@
{% endif %} {% include 'client/includes/banners/detail_inner_3.html' %} + + {% endblock %} + {% block content_text %} {% endblock %} + {% block popup %} {% include 'client/popups/advertise_member.html' with form=advertising_form %} {% endblock %} + {% block scripts %} -{% if request.GET.debug == '1' %} - -{% else %} - -{% endif %} - + {% if request.GET.debug == '1' %} + + {% else %} + + {% endif %} + {% endblock %} diff --git a/templates/client/includes/conference/conference_paid.html b/templates/client/includes/conference/conference_paid.html index e1dfbd4d..ed7a8a3e 100644 --- a/templates/client/includes/conference/conference_paid.html +++ b/templates/client/includes/conference/conference_paid.html @@ -388,13 +388,17 @@ {% endif %} {% include 'client/includes/banners/detail_inner_3.html' %} + + {% endblock %} {% block content_text %} diff --git a/templates/client/includes/exposition/expo_paid.html b/templates/client/includes/exposition/expo_paid.html index 9715b7e8..d48203dc 100644 --- a/templates/client/includes/exposition/expo_paid.html +++ b/templates/client/includes/exposition/expo_paid.html @@ -372,13 +372,16 @@ {% endif %} - {% endblock %} {% block content_text %} diff --git a/templates/client/includes/exposition/exposition_object.html b/templates/client/includes/exposition/exposition_object.html index 45337400..4e6df6e2 100644 --- a/templates/client/includes/exposition/exposition_object.html +++ b/templates/client/includes/exposition/exposition_object.html @@ -381,43 +381,48 @@

{% trans 'Смотрите также:' %}

{% trans "Выставки" %} {% if request.LANGUAGE_CODE == 'ru' and exposition.city.inflect %}{{ exposition.city.inflect }}{% else %}{% trans 'in' %} {{ exposition.city.name }}{% endif %} - {% trans "Выставки" %} {% if request.LANGUAGE_CODE == 'ru' and exposition.country.inflect %}{{ exposition.country.inflect }}{% else %}{% trans 'in' %} {{ exposition.country.name }}{% endif %} - {% trans "Выставки по тематике " %}«{{ exposition.theme.all.0.name|capfirst }}» {% if request.LANGUAGE_CODE == 'ru' and exposition.country.inflect %}{{ exposition.country.inflect }}{% else %}{% trans 'in' %} {{ exposition.country.name }}{% endif %} - {% trans "Выставки по тематике " %}«{{ exposition.theme.all.0.name|capfirst }}» {% if request.LANGUAGE_CODE == 'ru' and exposition.city.inflect %}{{ exposition.city.inflect }}{% else %}{% trans 'in' %} {{ exposition.city.name }}{% endif %} + {% trans "Выставки" %} {% if request.LANGUAGE_CODE == 'ru' and exposition.country.inflect %}{{ exposition.country.inflect }}{% else %}{% trans 'in' %} {{ exposition.country.name }}{% endif %} + {% if exposition.theme.all %} + {% trans "Выставки по тематике " %}«{{ exposition.theme.all.0.name|capfirst }}» {% if request.LANGUAGE_CODE == 'ru' and exposition.country.inflect %}{{ exposition.country.inflect }}{% else %}{% trans 'in' %} {{ exposition.country.name }}{% endif %} + {% trans "Выставки по тематике " %}«{{ exposition.theme.all.0.name|capfirst }}» {% if request.LANGUAGE_CODE == 'ru' and exposition.city.inflect %}{{ exposition.city.inflect }}{% else %}{% trans 'in' %} {{ exposition.city.name }}{% endif %} + {% endif %}
{% endblock %} + {% block content_text %} {% endblock %} + {% block popup %} {% include 'client/popups/advertise_member.html' with form=advertising_form %} {% endblock %} + {% block scripts %} -{% if request.GET.debug == '1' %} - -{% else %} - -{% endif %} - + {% if request.GET.debug == '1' %} + + {% else %} + + {% endif %} + {% endblock %} From f2a791cdc445d254cb4ca450a00336ad7cf7daf8 Mon Sep 17 00:00:00 2001 From: Alexander Burdeiny Date: Mon, 27 Jun 2016 12:41:38 +0300 Subject: [PATCH 3/3] =?UTF-8?q?1374:=20=D0=AD=D1=82=D0=B0=D0=BF=20?= =?UTF-8?q?=E2=84=964=20-=20=D0=A3=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9?= =?UTF-8?q?=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5=D0=B9=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B5=D0=BA=D1=81=D0=BF=D0=BE=20=D0=B8=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=84=20=D1=82=D0=B5=D0=BC=20=D0=B4=D0=BB=D1=8F=20=D0=B3=D0=BB?= =?UTF-8?q?=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fabfile.py | 11 +++ proj/views.py | 4 +- settings/admin.py | 4 +- settings/forms.py | 6 +- ...__add_field_theme_main_page_conf__add_f.py | 83 +++++++++++++++++++ theme/models.py | 3 +- 6 files changed, 102 insertions(+), 9 deletions(-) create mode 100644 theme/migrations/0004_auto__del_field_theme_main_page__add_field_theme_main_page_conf__add_f.py diff --git a/fabfile.py b/fabfile.py index f111c53b..da8f4af2 100644 --- a/fabfile.py +++ b/fabfile.py @@ -131,14 +131,25 @@ def c_fix(): def stage4_firstrun(): with cd(REMOTE_HOME_DIR): + call_state('stop') run('git fetch') run('git checkout stage4') run('git checkout -- proj/settings.py') pull(with_configs=True) run('python manage.py syncdb') + run('python manage.py migrate theme') + call_state('start') def ticket1395(): # stage4 with cd(REMOTE_HOME_DIR): run('python manage.py accounts_check_url') + + +def ticket1374(): + with cd(REMOTE_HOME_DIR): + call_state('stop', only='apache2') + run('git pull') + run('python manage.py migrate theme') + call_state('start', only='apache2') diff --git a/proj/views.py b/proj/views.py index 5b987c26..86e3005a 100644 --- a/proj/views.py +++ b/proj/views.py @@ -86,8 +86,8 @@ class MainPageView(JitterCacheMixin, TemplateView): # update main_page counter for event in events: event.main.link.log(self.request, 1) - exposition_themes = Theme.objects.language().filter(main_page=True, types=Theme.types.exposition)[:6] - conference_themes = Theme.objects.language().filter(main_page=True, types=Theme.types.conference)[:6] + exposition_themes = Theme.objects.language().filter(main_page_expo__gt=0, types=Theme.types.exposition)[:6] + conference_themes = Theme.objects.language().filter(main_page_conf__gt=0, types=Theme.types.conference)[:6] args = {'events': events, 'exposition_themes': exposition_themes, 'conference_themes': conference_themes, 'search_form': ExpositionSearchForm, 'search_action': '/expo/search/', diff --git a/settings/admin.py b/settings/admin.py index d6c0aba5..92184574 100644 --- a/settings/admin.py +++ b/settings/admin.py @@ -34,8 +34,8 @@ from article.models import Article def main_page(request): - exposition_themes = Theme.objects.filter(main_page__gt=0, types=Theme.types.exposition) - confrence_themes = Theme.objects.filter(main_page__gt=0, types=Theme.types.conference) + exposition_themes = Theme.objects.filter(main_page_expo__gt=0, types=Theme.types.exposition) + confrence_themes = Theme.objects.filter(main_page_conf__gt=0, types=Theme.types.conference) news = Article.objects.news().filter(main_page=1) blogs = Article.objects.blogs().filter(main_page=1) diff --git a/settings/forms.py b/settings/forms.py index be0ec18b..4e2deb47 100644 --- a/settings/forms.py +++ b/settings/forms.py @@ -40,10 +40,8 @@ class MainPageThemes(forms.Form): data = self.cleaned_data exposition_themes = data['exposition_themes'] conference_themes = data['conference_themes'] - - Theme.objects.filter().update(main_page=0) - exposition_themes.update(main_page=1) - conference_themes.update(main_page=1) + exposition_themes.update(main_page_expo=1) + conference_themes.update(main_page_conf=1) diff --git a/theme/migrations/0004_auto__del_field_theme_main_page__add_field_theme_main_page_conf__add_f.py b/theme/migrations/0004_auto__del_field_theme_main_page__add_field_theme_main_page_conf__add_f.py new file mode 100644 index 00000000..3e5b67d8 --- /dev/null +++ b/theme/migrations/0004_auto__del_field_theme_main_page__add_field_theme_main_page_conf__add_f.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +from south.utils import datetime_utils as datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Deleting field 'Theme.main_page' + db.delete_column(u'theme_theme', 'main_page') + + # Adding field 'Theme.main_page_conf' + db.add_column(u'theme_theme', 'main_page_conf', + self.gf('django.db.models.fields.PositiveIntegerField')(default=0, db_index=True), + keep_default=False) + + # Adding field 'Theme.main_page_expo' + db.add_column(u'theme_theme', 'main_page_expo', + self.gf('django.db.models.fields.PositiveIntegerField')(default=0, db_index=True), + keep_default=False) + + + def backwards(self, orm): + # Adding field 'Theme.main_page' + db.add_column(u'theme_theme', 'main_page', + self.gf('django.db.models.fields.PositiveIntegerField')(default=0, db_index=True), + keep_default=False) + + # Deleting field 'Theme.main_page_conf' + db.delete_column(u'theme_theme', 'main_page_conf') + + # Deleting field 'Theme.main_page_expo' + db.delete_column(u'theme_theme', 'main_page_expo') + + + models = { + u'theme.tag': { + 'Meta': {'unique_together': '()', 'object_name': 'Tag', 'index_together': '()'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inflect': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'old_url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}), + 'theme': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tags'", 'on_delete': 'models.PROTECT', 'to': u"orm['theme.Theme']"}), + 'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}) + }, + u'theme.tagtranslation': { + 'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'TagTranslation', 'db_table': "u'theme_tag_translation'", 'index_together': '()'}, + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'descriptions': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'keywords': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}), + 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), + 'main_title': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['theme.Tag']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + u'theme.theme': { + 'Meta': {'unique_together': '()', 'object_name': 'Theme', 'index_together': '()'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inflect': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'main_page_conf': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}), + 'main_page_expo': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}), + 'old_url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}), + 'types': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}), + 'url': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}) + }, + u'theme.themetranslation': { + 'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'ThemeTranslation', 'db_table': "u'theme_theme_translation'", 'index_together': '()'}, + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'descriptions': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'keywords': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), + 'main_title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['theme.Theme']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}) + } + } + + complete_apps = ['theme'] \ No newline at end of file diff --git a/theme/models.py b/theme/models.py index b7476db4..d8e1b3c5 100644 --- a/theme/models.py +++ b/theme/models.py @@ -54,7 +54,8 @@ class Theme(TranslatableModel): keywords = models.CharField(max_length=255, blank=True), ) - main_page = models.PositiveIntegerField(default=0, db_index=True) + main_page_conf = models.PositiveIntegerField(default=0, db_index=True) + main_page_expo = models.PositiveIntegerField(default=0, db_index=True) inflect = models.CharField(max_length=255, blank=True) def __unicode__(self):