Modify

Ticket #231 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

abstract=True and ForeignKey('self')

Reported by: kovalidis@… Owned by: andrew
Priority: major Milestone: 0.6.1
Component: commands Version: 0.6
Keywords: Cc:

Description

Have those models:

class TreeModel(models.Model):
    parent = models.ForeignKey('self', null=True, blank=True)

    class Meta:
        abstract=True

class MyModel(TreeModel):
    email = models.EmailField()

When I run:
python manage.py startmigration southtest --initial

I get next:

Creating migrations directory at '/home/alexk/projects/shop/trunk/southtest/migrations'...
Creating __init__.py in '/home/alexk/projects/shop/trunk/southtest/migrations'...
 + Added model 'southtest.MyModel'
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 362, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 303, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/home/alexk/projects/shop/trunk/south/management/commands/startmigration.py", line 299, in handle
    fields = modelsinspector.get_model_fields(model)
  File "/home/alexk/projects/shop/trunk/south/modelsinspector.py", line 240, in get_model_fields
    inherited_fields.update(get_model_fields(base))
  File "/home/alexk/projects/shop/trunk/south/modelsinspector.py", line 266, in get_model_fields
    args, kwargs = introspector(field)
  File "/home/alexk/projects/shop/trunk/south/modelsinspector.py", line 222, in introspector
    kwargs[kwd] = get_value(field, defn)
  File "/home/alexk/projects/shop/trunk/south/modelsinspector.py", line 175, in get_value
    default_value = get_attribute(field, options['default_attr'])
  File "/home/alexk/projects/shop/trunk/south/utils.py", line 34, in get_attribute
    value = getattr(value, part)
AttributeError: 'str' object has no attribute '_meta'

Attachments

Change History

comment:1 Changed 2 years ago by andrew

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

Fixed in [1ad15ec58637].

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.