Modify

Ticket #97 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Problem creating migration when removing model which has one-to-one relationship

Reported by: bendavis78@… Owned by: andrew
Priority: major Milestone: 0.5
Component: commands Version: 0.6-pre
Keywords: Cc:

Description

Old models.py (frozen in last migration):

class FooModel(models.Model):
    somefield = models.IntegerField()

class BarModel(models.Model):
    blahfield = models.IntegerField()
    myfoo = models.OneToOneField(FooModel, blank=True,null=True)

new models.py

class BarModel(models.Model):
    blafield = models.IntegerField()

startmigration output

$ ./manage.py startmigration testapp test --auto
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 350, in execute_manager
    utility.execute()
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 295, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/home/ben/Projects/southtest/south/management/commands/startmigration.py", line 245, in handle
    last_orm[mkey]._meta.get_field_by_name(fname)[0],
  File "/usr/lib/python2.5/site-packages/django/db/models/options.py", line 285, in get_field_by_name
    % (self.object_name, name))
django.db.models.fields.FieldDoesNotExist: barmodel has no field named 'myfoo'

Attachments

Change History

comment:1 Changed 5 years ago by andrew

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

Oh, the joys of what I found here. Should be fixed in [172], along with other bugs fixing this one made me find.

comment:2 Changed 5 years ago by andrew

  • Milestone set to 0.5
View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.