From e70f80d80ae1c9dbccd788dec08246a7a4bf8f32 Mon Sep 17 00:00:00 2001 From: Ivan Kovalkovskyi Date: Wed, 7 Oct 2015 16:08:57 +0300 Subject: [PATCH] conference alternative text admin support --- conference/admin.py | 4 ++-- conference/forms.py | 2 ++ templates/admin/conference/conference.html | 7 +++++++ templates/admin/conference/conference_add.html | 10 +++++++++- templates/admin/theme/theme_blog_new.html | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/conference/admin.py b/conference/admin.py index af2f95c5..7e22fc61 100644 --- a/conference/admin.py +++ b/conference/admin.py @@ -159,7 +159,7 @@ def conference_change(request, url): #initial StatisticFormSet StatisticFormSet = modelformset_factory(Statistic, form=StatisticForm, exclude=('conference',)) #fill form with data from database - data = {'web_page':conference.web_page, 'foundation_year': conference.foundation_year, + data = {'web_page':conference.web_page, 'place_alt': conference.place_alt, 'foundation_year': conference.foundation_year, 'data_begin':conference.data_begin, 'data_end':conference.data_end, 'currency':conference.currency, 'tax':conference.tax, 'min_price':conference.min_price, 'max_price':conference.max_price, 'link':conference.link, 'conference_id':conference.id, 'expohit': conference.expohit, @@ -233,7 +233,7 @@ class ConferenceView(AdminView): return super(ConferenceView, self).get_form(form_class) obj = self.set_obj() if obj: - data = {'web_page':obj.web_page, 'foundation_year': obj.foundation_year, + data = {'web_page':obj.web_page, 'place_alt':obj.place_alt, 'foundation_year': obj.foundation_year, 'data_begin':obj.data_begin, 'data_end':obj.data_end, 'currency':obj.currency, 'tax':obj.tax, 'min_price':obj.min_price, 'max_price':obj.max_price, 'link':obj.link, 'conference_id':obj.id, 'expohit': obj.expohit, 'periodic':obj.periodic, diff --git a/conference/forms.py b/conference/forms.py index 897f441b..4cba3c0b 100644 --- a/conference/forms.py +++ b/conference/forms.py @@ -56,6 +56,7 @@ class ConferenceCreateForm(forms.Form): place = forms.ChoiceField(label=u'Место проведения', required=False, choices=places) + place_alt = forms.CharField(label = u"Альтернативное название места", required=False) #creates select input with empty choices cause it will be filled with ajax city = forms.CharField(label=u'Город', widget=forms.HiddenInput()) @@ -160,6 +161,7 @@ class ConferenceCreateForm(forms.Form): conference.canceled = data['canceled'] conference.moved = data['moved'] conference.periodic = data['periodic'] + conference.place_alt = data['place_alt'] # generates bitfield flag = 0 if data['quality_label']: diff --git a/templates/admin/conference/conference.html b/templates/admin/conference/conference.html index 51811f7f..8d6a7f6b 100644 --- a/templates/admin/conference/conference.html +++ b/templates/admin/conference/conference.html @@ -134,6 +134,13 @@ {{ form.place.errors }} + {# place_alt #} +
+ +
{{ form.place_alt }} + {{ form.place_alt.errors }} +
+
{# theme #}
diff --git a/templates/admin/conference/conference_add.html b/templates/admin/conference/conference_add.html index efe93065..39fb4a90 100644 --- a/templates/admin/conference/conference_add.html +++ b/templates/admin/conference/conference_add.html @@ -47,7 +47,7 @@
-

Основная информация

+

Основная информаdция

{# Hidden inputs uses for comparing with TmpFile objects #} @@ -99,6 +99,14 @@ {{ form.place.errors }}
+ + {# place #} +
+ +
{{ form.place_alt }} + {{ form.place_alt.errors }} +
+
{# theme #}
diff --git a/templates/admin/theme/theme_blog_new.html b/templates/admin/theme/theme_blog_new.html index 9ee2b388..fe5406b8 100644 --- a/templates/admin/theme/theme_blog_new.html +++ b/templates/admin/theme/theme_blog_new.html @@ -17,7 +17,7 @@
{% csrf_token %}{{ form.errors }}
- {% if theme_id %} Изменить {% else %} Добавить {% endif %}тему + {% if object %} Изменить {% else %} Добавить {% endif %}тему

Информация