Opened 18 years ago

Closed 18 years ago

#3894 closed (duplicate)

ManyToMany breaks in admin on python 2.3

Reported by: Øyvind Saltvik <oyvind.saltvik@…> Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

class Bug(models.Model):
    some_field = models.CharField(maxlength=30)
    belongs_to_sites = models.ManyToManyField(Site, null=True, blank=True)

    class Admin:
        pass

Testing the exact same model on python2.3, breaks with this error: "Cannot resolve keyword 'bug' into field."

get_all_related_many_to_many_objects seems to not add a RelatedObject with this model to the list.

Change History (2)

comment:1 by Øyvind Saltvik <oyvind.saltvik@…>, 18 years ago

Traceback

Traceback (most recent call last):
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/core/handlers/base.py" in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/contrib/admin/views/decorators.py" in _checklogin
  55. return view_func(request, *args, **kwargs)
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/views/decorators/cache.py" in _wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/contrib/admin/views/main.py" in change_stage
  363. new_data = manipulator.flatten_data()
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/manipulators.py" in flatten_data
  248. new_data.update(f.flatten_data(fol, obj))
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/fields/related.py" in flatten_data
  700. instance_ids = [instance._get_pk_val() for instance in getattr(obj, self.name).all()]
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/query.py" in __iter__
  108. return iter(self._get_data())
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/query.py" in _get_data
  470. self._result_cache = list(self.iterator())
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/query.py" in iterator
  174. select, sql, params = self._get_sql_clause()
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/query.py" in _get_sql_clause
  484. joins2, where2, params2 = self._filters.get_sql(opts)
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/query.py" in get_sql
  648. joins2, where2, params2 = val.get_sql(opts)
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/query.py" in get_sql
  699. return parse_lookup(self.kwargs.items(), opts)
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/query.py" in parse_lookup
  831. joins2, where2, params2 = lookup_inner(path, lookup_type, value, opts, opts.db_table, None)
File "/var/www/vhosts/il-sverre.no/httpdocs/trunk/django/db/models/query.py" in lookup_inner
  938. raise TypeError, "Cannot resolve keyword '%s' into field" % name

  TypeError at /admin/bugtest/bug/
  Cannot resolve keyword 'bug' into field

comment:2 by James Bennett, 18 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #1796.

Note: See TracTickets for help on using tickets.
Back to Top