I decided to define the following helper function in my module module:
from uuid import uuid4 def generateUUID(): return str(uuid4())
then
f = models.CharField(default=generateUUID, max_length=36, unique=True, editable=False)
south will generate a migration file (migrations.0001_initial) with the generated UUID, for example:
default='5c88ff72-def3-4842-8d48-a75bb3240bb5'
this is pretty unfortunate ... since this line is "static", instead it should be created dynamically with a helper function ... anyway, in the django world, it seems to work as expected ... I added some records to the database and a new UUID for each of them. Then I tried to complete my first schema migration by adding a couple of fields to my model, and they were added to the database table, as expected.
daveoncode
source share