Opened 11 years ago
Closed 11 years ago
#23255 closed Uncategorized (worksforme)
Migrations fail with custom models.Field
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Migrations | Version: | 1.7-rc-2 |
| Severity: | Release blocker | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Follow the example at https://docs.djangoproject.com/en/dev/howto/custom-model-fields/#writing-a-field-subclass
and try to run ./manage.py migrate
The following exception is given:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/patrick/.virtualenvs/migr/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/patrick/.virtualenvs/migr/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/patrick/.virtualenvs/migr/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/patrick/.virtualenvs/migr/lib/python2.7/site-packages/django/core/management/base.py", line 337, in execute
output = self.handle(*args, **options)
File "/Users/patrick/.virtualenvs/migr/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 153, in handle
ProjectState.from_apps(apps),
File "/Users/patrick/.virtualenvs/migr/lib/python2.7/site-packages/django/db/migrations/state.py", line 104, in from_apps
model_state = ModelState.from_model(model)
File "/Users/patrick/.virtualenvs/migr/lib/python2.7/site-packages/django/db/migrations/state.py", line 181, in from_model
e,
TypeError: Couldn't reconstruct field field1 on migr2.MyModel: __init__() got multiple values for keyword argument 'verbose_name'
See my example project at https://github.com/pjrobertson/django_migrations_bug2
and run ./manage.py migrate to reproduce
Note:
See TracTickets
for help on using tickets.
Hi,
Your code incorrectly passes
selfwhen calling thesuper(...)in__init__:Should be:
(as is documented)
Thanks.