Ticket #143 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

AttributeError when removing self-referential FK

Reported by: shannon Owned by: andrew
Priority: major Milestone: 0.6
Component: commands Version: 0.6-pre
Keywords: Cc:


Using today's svn (r240) i was unable to create a migration that moved a self-referential FK. Here's the traceback:

C:\django\tacc>manage.py startmigration profiles remove_agencyprofile_fks --auto

 - Deleted field 'profiles.agencyprofile.parent_agency'
Traceback (most recent call last):
  File "C:\django\tacc\manage.py", line 11, in <module>
  File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line 361, in execute_manager
  File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line 306, in execute
  File "C:\Python25\lib\site-packages\django\core\management\base.py", line 192, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python25\lib\site-packages\django\core\management\base.py", line 219, in execute
    output = self.handle(*args, **options)
  File "C:\django-apps\south\management\commands\startmigration.py", line 410, in handle
    deps = field_dependencies(field, last_models)
  File "C:\django-apps\south\management\commands\startmigration.py", line 668, in field_dependencies
    depends.update(stub_model_dependencies(field.rel.to, last_models))
  File "C:\django-apps\south\management\commands\startmigration.py", line 662, in stub_model_dependencies
    return field_dependencies(model._meta.pk, last_models)
AttributeError: 'str' object has no attribute '_meta'

Attached is the models.py file, stripped down, and indicating the two fields i tried removing.


models.py (1.4 KB) - added by anonymous 7 years ago.

Change History

Changed 7 years ago by anonymous

comment:1 Changed 7 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.6

Fixed in [248].

comment:2 Changed 7 years ago by shannon

i'm impressed by how responsive you are in developing this project.

If anyone was following this ticket, after updating South to r248 i had to remove /profiles/migrations, run 'convert_to_south' again, then run the 'startmigration' command. At first i just tried the 'startmigration' but had the same error.

comment:3 Changed 7 years ago by andrew

Ah yes, should have said you'd need to recreate the previous migration as well. Still, well found.

(The problem was that the freezing wasn't handling your string declaration of the other model right).

Note: See TracTickets for help on using tickets.