participationcomment migration fix

remotes/origin/search
Alexander Burdeiny 10 years ago
parent 8c1e820bf1
commit 1fb9d259ea
  1. 4
      core/simple_index_view.py
  2. 4
      expobanner/admin.py
  3. 4
      settings/forms.py
  4. 48
      settings/migrations/0003_auto__add_participationcomment__add_participationcommenttranslation__a.py
  5. 2
      settings/models.py

@ -9,7 +9,7 @@ from functions.cache_mixin import JitterCacheMixin
from meta.views import MetadataMixin from meta.views import MetadataMixin
#from forms import CallbackForm #from forms import CallbackForm
from service.order_forms import CallBackForm, ParticipationLandingForm from service.order_forms import CallBackForm, ParticipationLandingForm
from settings.models import LandingComment, LandingParticipationComment from settings.models import LandingComment, ParticipationComment
class AdvertisingView(MetadataMixin, TemplateView): class AdvertisingView(MetadataMixin, TemplateView):
@ -54,7 +54,7 @@ class ParticipationViewLanding(JitterCacheMixin, MetadataMixin, FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(ParticipationViewLanding, self).get_context_data(**kwargs) context = super(ParticipationViewLanding, self).get_context_data(**kwargs)
context['comments'] = LandingParticipationComment.objects.language().all() context['comments'] = ParticipationComment.objects.language().all()
context['articles'] = Article.objects.blogs().filter(theme__url='praktikum-eksponenta')[:4] context['articles'] = Article.objects.blogs().filter(theme__url='praktikum-eksponenta')[:4]
context['specialist_count'] = Contact.objects.all().count() context['specialist_count'] = Contact.objects.all().count()
return context return context

@ -34,7 +34,7 @@ from expobanner.forms import (
from expobanner.models import URL, Banner, BannerGroup, MainPage, Paid, Top from expobanner.models import URL, Banner, BannerGroup, MainPage, Paid, Top
from exposition.models import Exposition from exposition.models import Exposition
from settings.forms import CommentForm, HtmlForm, ParticipationCommentForm from settings.forms import CommentForm, HtmlForm, ParticipationCommentForm
from settings.models import Html, LandingComment, LandingParticipationComment from settings.models import Html, LandingComment, ParticipationComment
class BannersControl(TemplateView): class BannersControl(TemplateView):
@ -182,7 +182,7 @@ class CommentMixin(object):
class ParticipationMixin(CommentMixin): class ParticipationMixin(CommentMixin):
form_class = ParticipationCommentForm form_class = ParticipationCommentForm
model = LandingParticipationComment model = ParticipationComment
success_url = reverse_lazy('expobaner-pcomment_list') success_url = reverse_lazy('expobaner-pcomment_list')

@ -2,7 +2,7 @@
from django import forms from django import forms
from ckeditor.widgets import CKEditorWidget from ckeditor.widgets import CKEditorWidget
from theme.models import Theme from theme.models import Theme
from .models import Html, LandingComment, LandingParticipationComment from .models import Html, LandingComment, ParticipationComment
from article.models import Article from article.models import Article
from functions.forms import ExpoTranslatableModelForm, ExpoTranslatableModelForm_ from functions.forms import ExpoTranslatableModelForm, ExpoTranslatableModelForm_
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
@ -27,7 +27,7 @@ class CommentForm(ExpoTranslatableModelForm_):
class ParticipationCommentForm(CommentForm): class ParticipationCommentForm(CommentForm):
class Meta: class Meta:
model = LandingParticipationComment model = ParticipationComment
class MainPageThemes(forms.Form): class MainPageThemes(forms.Form):

@ -8,37 +8,37 @@ from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):
def forwards(self, orm): def forwards(self, orm):
# Adding model 'LandingParticipationCommentTranslation' # Adding model 'ParticipationComment'
db.create_table(u'settings_landingparticipationcomment_translation', ( db.create_table(u'settings_participationcomment', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('logo', self.gf('django.db.models.fields.files.ImageField')(max_length=255)),
))
db.send_create_signal(u'settings', ['ParticipationComment'])
# Adding model 'ParticipationCommentTranslation'
db.create_table(u'settings_participationcomment_translation', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('text', self.gf('django.db.models.fields.TextField')()), ('text', self.gf('django.db.models.fields.TextField')()),
('name', self.gf('django.db.models.fields.CharField')(max_length=255)), ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
('position', self.gf('django.db.models.fields.CharField')(max_length=255)), ('position', self.gf('django.db.models.fields.CharField')(max_length=255)),
('language_code', self.gf('django.db.models.fields.CharField')(max_length=15, db_index=True)), ('language_code', self.gf('django.db.models.fields.CharField')(max_length=15, db_index=True)),
('master', self.gf('django.db.models.fields.related.ForeignKey')(related_name='translations', null=True, to=orm['settings.LandingParticipationComment'])), ('master', self.gf('django.db.models.fields.related.ForeignKey')(related_name='translations', null=True, to=orm['settings.ParticipationComment'])),
)) ))
db.send_create_signal(u'settings', ['LandingParticipationCommentTranslation']) db.send_create_signal(u'settings', ['ParticipationCommentTranslation'])
# Adding unique constraint on 'LandingParticipationCommentTranslation', fields ['language_code', 'master'] # Adding unique constraint on 'ParticipationCommentTranslation', fields ['language_code', 'master']
db.create_unique(u'settings_landingparticipationcomment_translation', ['language_code', 'master_id']) db.create_unique(u'settings_participationcomment_translation', ['language_code', 'master_id'])
# Adding model 'LandingParticipationComment'
db.create_table(u'settings_landingparticipationcomment', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('logo', self.gf('django.db.models.fields.files.ImageField')(max_length=255)),
))
db.send_create_signal(u'settings', ['LandingParticipationComment'])
def backwards(self, orm): def backwards(self, orm):
# Removing unique constraint on 'LandingParticipationCommentTranslation', fields ['language_code', 'master'] # Removing unique constraint on 'ParticipationCommentTranslation', fields ['language_code', 'master']
db.delete_unique(u'settings_landingparticipationcomment_translation', ['language_code', 'master_id']) db.delete_unique(u'settings_participationcomment_translation', ['language_code', 'master_id'])
# Deleting model 'LandingParticipationCommentTranslation' # Deleting model 'ParticipationComment'
db.delete_table(u'settings_landingparticipationcomment_translation') db.delete_table(u'settings_participationcomment')
# Deleting model 'LandingParticipationComment' # Deleting model 'ParticipationCommentTranslation'
db.delete_table(u'settings_landingparticipationcomment') db.delete_table(u'settings_participationcomment_translation')
models = { models = {
@ -68,16 +68,16 @@ class Migration(SchemaMigration):
'position': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'position': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'text': ('django.db.models.fields.TextField', [], {}) 'text': ('django.db.models.fields.TextField', [], {})
}, },
u'settings.landingparticipationcomment': { u'settings.participationcomment': {
'Meta': {'unique_together': '()', 'object_name': 'LandingParticipationComment', 'index_together': '()'}, 'Meta': {'unique_together': '()', 'object_name': 'ParticipationComment', 'index_together': '()'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '255'}) 'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '255'})
}, },
u'settings.landingparticipationcommenttranslation': { u'settings.participationcommenttranslation': {
'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'LandingParticipationCommentTranslation', 'db_table': "u'settings_landingparticipationcomment_translation'", 'index_together': '()'}, 'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'ParticipationCommentTranslation', 'db_table': "u'settings_participationcomment_translation'", 'index_together': '()'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['settings.LandingParticipationComment']"}), 'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['settings.ParticipationComment']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'position': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'position': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'text': ('django.db.models.fields.TextField', [], {}) 'text': ('django.db.models.fields.TextField', [], {})

@ -62,7 +62,7 @@ class LandingComment(TranslatableModel):
return self return self
class LandingParticipationComment(TranslatableModel): class ParticipationComment(TranslatableModel):
translations = TranslatedFields( translations = TranslatedFields(
text=models.TextField(verbose_name=_(u'Комментарий')), text=models.TextField(verbose_name=_(u'Комментарий')),
name=models.CharField(verbose_name=_(u'Имя Фамилия'), max_length=255), name=models.CharField(verbose_name=_(u'Имя Фамилия'), max_length=255),

Loading…
Cancel
Save