Hi all,

in one of my models I have

class Watchfolder(models.Model):

  formats = models.ManyToManyField(Format)

  destination = models.ManyToManyField(
    Destination,
    related_name="WFDestinations",
    limit_choices_to={'metadata_destination':False},
    blank=True,
    validator_list=[destination_validator])

  destination_metadata = models.ManyToManyField(
    Destination,
    related_name="WFMetadataDestinations",
    limit_choices_to={'metadata_destination':True},
    blank=True,
    validator_list=[md_destination_validator])

When I try to get at these managers I get:

>>> w.formats.all()
Traceback (most recent call last):
  File "<console>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 88, in __repr__
    return repr(self._get_data())
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 383, in _get_data
    self._result_cache = list(self.iterator())
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 159, in iterator
    select, sql, params = self._get_sql_clause()
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 397, in _get_sql_clause
    tables2, joins2, where2, params2 = self._filters.get_sql(opts)
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 528, in get_sql
    tables2, joins2, where2, params2 = val.get_sql (opts)
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 577, in get_sql
    return parse_lookup(self.kwargs.items(), opts)
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 682, in parse_lookup
    tables2, joins2, where2, params2 = lookup_inner(path, clause, value, opts, opts.db_table, None)
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 785, in lookup_inner
    raise TypeError, "Cannot resolve keyword '%s' into field" % name
TypeError: Cannot resolve keyword 'watchfolder' into field

for formats and for destination:

>>> w.destination.all()
Traceback (most recent call last):
  File "<console>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 88, in __repr__
    return repr(self._get_data())
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 383, in _get_data
    self._result_cache = list(self.iterator())
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 159, in iterator
    select, sql, params = self._get_sql_clause()
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 397, in _get_sql_clause
    tables2, joins2, where2, params2 = self._filters.get_sql(opts)
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 528, in get_sql
    tables2, joins2, where2, params2 = val.get_sql (opts)
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 577, in get_sql
    return parse_lookup(self.kwargs.items(), opts)
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 682, in parse_lookup
    tables2, joins2, where2, params2 = lookup_inner(path, clause, value, opts, opts.db_table, None)
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py", line 785, in lookup_inner
    raise TypeError, "Cannot resolve keyword '%s' into field" % name
TypeError: Cannot resolve keyword 'WFDestinations' into field


I know I can workaround this problem by going at it from behind so to speak, that is
for format in Format.objects.all():
  for wf in format.watchfolder_set.all ():
    if wf == my_watchfolder:

but somehow that doesn't satisfy me. Am I doing anything wrong or is there just something broken?

chris

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to