Andrew, Shai,
Thanks for your replies and assistance. As Shai noted it's not a
custom field type but rather an unusual type of default value.
Here's a fuller traceback (I've changed the model and app names for
the purposes of the examples I've posted, by the way):
% ./manage.py schemamigration MyApp --auto
Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_manager(settings)
File "/u/virtualenvs/django131/lib/python2.7/site-packages/django/
core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/u/virtualenvs/django131/lib/python2.7/site-packages/django/
core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/u/virtualenvs/django131/lib/python2.7/site-packages/django/
core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/u/virtualenvs/django131/lib/python2.7/site-packages/django/
core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/u/virtualenvs/django131/lib/python2.7/site-packages/south/
management/commands/schemamigration.py", line 97, in handle
old_orm = last_migration.orm(),
File "/u/virtualenvs/django131/lib/python2.7/site-packages/south/
utils/__init__.py", line 62, in method
value = function(self)
File "/u/virtualenvs/django131/lib/python2.7/site-packages/south/
migration/base.py", line 427, in orm
return FakeORM(self.migration_class(), self.app_label())
File "/u/virtualenvs/django131/lib/python2.7/site-packages/south/
orm.py", line 45, in FakeORM
_orm_cache[args] = _FakeORM(*args)
File "/u/virtualenvs/django131/lib/python2.7/site-packages/south/
orm.py", line 131, in __init__
self.retry_failed_fields()
File "/u/virtualenvs/django131/lib/python2.7/site-packages/south/
orm.py", line 370, in retry_failed_fields
fname, modelname, e
ValueError: Cannot successfully create field 'uuid' for model
'MySubThing': name 'UUID' is not defined.
My models work like this:
MyOtherApp/models.py:
from uuid import uuid4
class MyThing(models.Model):
uuid = models.CharField(default=uuid4, unique=True)
...
class MySubThing(MyThing):
temperature = models.CharField(max_length=40, blank=True,
editable=False, verbose_name="temperature")
...
The two models above are stored in a different app to the one I'm
migrating, but the app that I'm migrating has a model with MySubThing
as a OneToOneField, so South is traversing MyOtherApp in the process
of writing the migration for MyApp:
MyApp/models.py:
from Sprockets.MyOtherApp.models import Widget
class SuperAwesomeItem(models.Model):
widget = models.OneToOneField(Widget)
I can't find 'UUID' (in uppercase) anywhere in my models, however when
I run 'uuid4()' on the shell, I get a UUID object whose normal
representation appears to start with 'UUID':
>>> from uuid import uuid4
>>> uuid4()
UUID('99adae06-2215-4fab-b6e3-09db25ea4108')
>>> str(uuid4())
'9b851075-58cc-482b-9ab5-17a04ac36cd6'
>>>
I wonder if that's where South is choking.
Regards,
Graeme