Modify ↓
Ticket #231 (closed defect: fixed)
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
Note: See
TracTickets for help on using
tickets.

Fixed in [1ad15ec58637].