Ticket #454 (closed defect: worksforme)

Opened 6 years ago

Last modified 5 years ago

ManyToMany Self Referential Doesn't get is_hidden Set

Reported by: mtrier@… Owned by: andrew
Priority: major Milestone: 0.7.2
Component: migrations Version: 0.7
Keywords: Cc:


I have a Self Referential ManyToManyField?. When validating the models this field comes in as self.rel.is_hidden() == True. When using South's schemamigration this field comes in with self.rel.is_hidden() == None causing the line:

setattr(cls, related.get_accessor_name(), ManyRelatedObjectsDescriptor(related))

The issue is the related.get_accessor_name() returns None since there is no accessor.

Traceback (most recent call last):
  File "./manage.py", line 13, in <module>
  File "/Users/mtrier/dev/django/django/core/management/__init__.py", line 438, in execute_manager
  File "/Users/mtrier/dev/django/django/core/management/__init__.py", line 379, in execute
  File "/Users/mtrier/dev/django/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/mtrier/dev/django/django/core/management/base.py", line 223, in execute
    output = self.handle(*args, **options)
  File "/Users/mtrier/.virtualenv/pcusa_cms/lib/python2.6/site-packages/south/management/commands/schemamigration.py", line 98, in handle
    old_orm = last_migration.orm(),
  File "/Users/mtrier/.virtualenv/pcusa_cms/lib/python2.6/site-packages/south/utils.py", line 62, in method
    value = function(self)
  File "/Users/mtrier/.virtualenv/pcusa_cms/lib/python2.6/site-packages/south/migration/base.py", line 418, in orm
    return FakeORM(self.migration_class(), self.app_label())
  File "/Users/mtrier/.virtualenv/pcusa_cms/lib/python2.6/site-packages/south/orm.py", line 46, in FakeORM
    _orm_cache[args] = _FakeORM(*args)  
  File "/Users/mtrier/.virtualenv/pcusa_cms/lib/python2.6/site-packages/south/orm.py", line 125, in __init__
    self.models[name] = self.make_model(app_label, model_name, data)
  File "/Users/mtrier/.virtualenv/pcusa_cms/lib/python2.6/site-packages/south/orm.py", line 344, in make_model
  File "/Users/mtrier/dev/django/django/db/models/base.py", line 193, in __new__
  File "/Users/mtrier/dev/django/django/db/models/base.py", line 238, in _prepare
  File "/Users/mtrier/dev/django/django/dispatch/dispatcher.py", line 166, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/mtrier/dev/django/django/db/models/fields/related.py", line 82, in do_pending_lookups
    operation(field, sender, cls)
  File "/Users/mtrier/dev/django/django/db/models/fields/related.py", line 107, in resolve_related_class
    field.do_related_class(model, cls)
  File "/Users/mtrier/dev/django/django/db/models/fields/related.py", line 122, in do_related_class
    self.contribute_to_related_class(other, self.related)
  File "/Users/mtrier/dev/django/django/db/models/fields/related.py", line 1127, in contribute_to_related_class
    setattr(cls, related.get_accessor_name(), ManyRelatedObjectsDescriptor(related))
TypeError: attribute name must be string, not 'NoneType'

Change History

comment:1 Changed 6 years ago by andrew

  • Status changed from new to infoneeded
  • Milestone changed from 0.7.1 to 0.7.2

What version of Django are you running? There have been some issues with M2Ms, South 0.7 and Django 1.2 beta, but they were fixed in Django trunk (they were more general issues than just us).

comment:2 Changed 5 years ago by andrew

  • Status changed from infoneeded to closed
  • Resolution set to worksforme

Closing as worksforme, no response.

Note: See TracTickets for help on using tickets.