I've always done this to create migrations for the fields in
EXTRA_MODEL_FIELDS,
http://dodgyville.tumblr.com/post/23028930440/new-fields-in-mezzanine-without-editing-or

The above is basically:
1.  Set up the EXTRA_MODEL_FIELDS setting
2. Run the following
$ python manage.py schemamigration forms --auto --stdout
> form_mods/migrations/0001_form_add_fields.py
$ python manage.py migrate form_mods

The above assumes your extra fields affect the forms and that an app
called form_mods exists in your project that the migrations can go into.

In Mezzanine 4 with Django 1.8 I've tried the following:
1.  Set up the EXTRA_MODEL_FIELDS setting
2.  Run the following:
$ python manage.py makemigrations --dry-run --verbosity 3
3. Copy the migration that was output to stdout into a migrations file, for
example form_mods/migrations/0001_form_add_fields.py
4.  Run the following:
$ python manage.py migrate form_mods

That produces errors like:

  File "manage.py", line 14, in <module>
    execute_from_command_line(sys.argv)
  File
"/path/to/virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py",
line 338, in execute_from_command_line
    utility.execute()
  File
"/path/to/virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py",
line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/path/to/virtualenv/lib/python2.7/site-packages/django/core/management/base.py",
line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File
"/path/to/virtualenv/lib/python2.7/site-packages/django/core/management/base.py",
line 444, in execute
    output = self.handle(*args, **options)
  File
"/path/to/virtualenv/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
line 221, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File
"/path/to/virtualenv/lib/python2.7/site-packages/django/db/migrations/executor.py",
line 104, in migrate
    state = migration.mutate_state(state, preserve=do_run)
  File
"/path/to/virtualenv/lib/python2.7/site-packages/django/db/migrations/migration.py",
line 83, in mutate_state
    operation.state_forwards(self.app_label, new_state)
  File
"/path/to/virtualenv/lib/python2.7/site-packages/django/db/migrations/operations/fields.py",
line 50, in state_forwards
    state.models[app_label, self.model_name_lower].fields.append((self.name,
field))
KeyError: (u'form_mods', u'form')

Anyone have any ideas on a workaround?

Thanks!

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to