Another note: if I comment out 'sites = models.ManyToManyField(Site)'
from Team, it loads fine.  The same if I use it as a ForeignKey
field.  I'm using the latest stable, 0.96.

On Jul 16, 11:01 am, Jeff <[EMAIL PROTECTED]> wrote:
> I'm throwing an error when loading the admin edit page for an instance
> of a model.  The exception itself is a TypeError, "Cannot resolve
> keyword 'team' into field."  It is being raised at db.models.query
> line 938.  I've included the full trace below.
>
> The model is Team, which has a ManyToMany relationship with Site, and
> a ForeignKey field of Sport.  Both tables are below as well.
>
> I can't for the life of me figure out what the problem is.  The team
> has an entry under app_team_sites, the sport exists, and the site
> listed in app_team_sites for the team exists.  Does anyone have any
> ideas?  I don't see anything relevant on the django bug tracker.
>
> Jeff
>
> --- Models ---
>
> class Sport(models.Model):
>     sport_name = models.CharField(maxlength=50, unique=True)
>     def __str__(self):
>         return self.sport_name
>     class Admin:
>         save_on_top = True
>
> class Team(models.Model):
>     sites = models.ManyToManyField(Site)
>     sport = models.ForeignKey(Sport)
>     team_name = models.CharField(maxlength=75)
>     logo_url = models.URLField(verify_exists=True, blank=True)
>     def __str__(self):
>         return self.team_name
>     class Meta:
>         unique_together = (("sport", "team_name"),)
>     class Admin:
>         list_display = ['sport', 'team_name', 'logo_url']
>         list_display_links = ['sport', 'team_name', 'logo_url']
>         list_filter = ['sport', 'sites']
>         ordering = ['sport', 'team_name']
>         search_fields = ['sport', 'team_name']
>         save_on_top = True
>
> --- Trace ---
>
> Traceback (most recent call last):
> File "/sw/lib/python2.5/site-packages/django/core/handlers/base.py" in
> get_response
>   77. response = callback(request, *callback_args, **callback_kwargs)
> File "/sw/lib/python2.5/site-packages/django/contrib/admin/views/
> decorators.py" in _checklogin
>   55. return view_func(request, *args, **kwargs)
> File "/sw/lib/python2.5/site-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   39. response = view_func(request, *args, **kwargs)
> File "/sw/lib/python2.5/site-packages/django/contrib/admin/views/
> main.py" in change_stage
>   363. new_data = manipulator.flatten_data()
> File "/sw/lib/python2.5/site-packages/django/db/models/
> manipulators.py" in flatten_data
>   248. new_data.update(f.flatten_data(fol, obj))
> File "/sw/lib/python2.5/site-packages/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 "/sw/lib/python2.5/site-packages/django/db/models/query.py" in
> __iter__
>   108. return iter(self._get_data())
> File "/sw/lib/python2.5/site-packages/django/db/models/query.py" in
> _get_data
>   470. self._result_cache = list(self.iterator())
> File "/sw/lib/python2.5/site-packages/django/db/models/query.py" in
> iterator
>   174. select, sql, params = self._get_sql_clause()
> File "/sw/lib/python2.5/site-packages/django/db/models/query.py" in
> _get_sql_clause
>   484. joins2, where2, params2 = self._filters.get_sql(opts)
> File "/sw/lib/python2.5/site-packages/django/db/models/query.py" in
> get_sql
>   648. joins2, where2, params2 = val.get_sql(opts)
> File "/sw/lib/python2.5/site-packages/django/db/models/query.py" in
> get_sql
>   699. return parse_lookup(self.kwargs.items(), opts)
> File "/sw/lib/python2.5/site-packages/django/db/models/query.py" in
> parse_lookup
>   831. joins2, where2, params2 = lookup_inner(path, lookup_type,
> value, opts, opts.db_table, None)
> File "/sw/lib/python2.5/site-packages/django/db/models/query.py" in
> lookup_inner
>   938. raise TypeError, "Cannot resolve keyword '%s' into field" %
> name
>
>   TypeError at /admin/pickem/team/1/
>   Cannot resolve keyword 'team' into field


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to