#23851: 'GenericForeignKey' object has no attribute 'deconstruct'
-------------------------------------+-------------------------------------
Reporter: corebreaker | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.7
contrib.contenttypes | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by corebreaker):
I joined a Django project that has the bug, use ''migrate'' command. The
result is:
{{{
Operations to perform:
Synchronize unmigrated apps: staticfiles, messages
Apply all migrations: admin, contenttypes, formbug, auth, sessions
Synchronizing apps without migrations:
Creating tables...
Installing custom SQL...
Installing indexes...
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying formbug.0001_initial...Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 385, in
execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/commands/migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 63, in migrate
self.apply_migration(migration, fake=fake)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 91, in apply_migration
if self.detect_soft_applied(migration):
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 135, in
detect_soft_applied
apps = project_state.render()
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/state.py", line 67, in render
model.render(self.apps)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/state.py", line 305, in render
body = dict(self.construct_fields())
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/state.py", line 276, in construct_fields
_, path, args, kwargs = field.deconstruct()
}}}
I just used `GenericForeignKey` class as a model field. In Django 1.7,
model fields require to implement `deconstruct` method. But
`GenericForeignKey` has not implemented this method.
--
Ticket URL: <https://code.djangoproject.com/ticket/23851#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.ef8c7a2149edb97c5cf1f160eaf867da%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.