Hello list,
I am trying to create a new content type for my own type of page, and I am
running into problems with newest django. I don't know if the problem I'm
facing is in mezzanine itself, south, or django, so please redirect me to
the right group if this is completely off-topic.
I re-created the problem by starting a brand new mezzanine application, and
adding a new app "myapp". My 'pip freeze' contains Django==1.5.5 and
south==0.8.4. Before I do anything, I create an initial migration for
"myapp":
./manage.py schemamigration myapp --initial
I then modify my models file to create a new content type based on the Page
base model:
from mezzanine.pages.models import Page
# Create your models here.
class MyPage(Page):
pass
Running an auto migration generates a migration that creates this table:
./manage.py schemamigration myapp --auto
Predictably, the only thing in the table is a pointer to the ancestor
content type. All good (this is the 'forwards' portion of the migration:
def forwards(self, orm):
# Adding model 'MyPage'
db.create_table(u'myapp_mypage', (
(u'page_ptr',
self.gf('django.db.models.fields.related.OneToOneField')(to=orm['pages.Page'],
unique=True, primary_key=True)),
))
db.send_create_signal(u'myapp', ['MyPage'])
However, if I use django 1.6.1:
pip install -U django
I move the second migration out of the way, and re-run the schema migration:
./manage.py schemamigration myapp --auto
I now get an additional field ('keywords_string') in my derived model
table, which begins to cause problems:
def forwards(self, orm):
# Adding model 'MyPage'
db.create_table(u'myapp_mypage', (
(u'page_ptr',
self.gf('django.db.models.fields.related.OneToOneField')(to=orm['pages.Page'],
unique=True, primary_key=True)),
('keywords_string',
self.gf('django.db.models.fields.CharField')(max_length=500, blank=True)),
))
db.send_create_signal(u'myapp', ['MyPage'])
When I try to run this migration, I get the following error from
"./manage.py migrate myapp":
django.core.exceptions.FieldError: Local field 'keywords_string' in class
'MyPage' clashes with field of similar name from base class 'Page'
And if I try to do something sneaky, like remove the field from the
migration manually, it causes more problems. I am able to successfully run
the migration with 'keywords_string" manually removed from the migration
script, but when I try to run the app and access the admin
("http://localhost:8000/admin/pages/page/"), I get the error:
OperationalError at /admin/pages/page/
no such column: pages_richtextpage.keywords_string
Any advice is greatly appreciated. I'm unfortunately not able to use
django-1.5.5, so I need to be able to perform this in 1.6.1. Any tips?
Thanks,
David
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.