I seem to really be struggling with many-to-many and getting it all to 
work. I'm using trunk (ver 2909) Here's the model I'm using-

class Reporter(models.Model):
    fname = models.CharField(maxlength=30)
    lname = models.CharField(maxlength=30)
   
    class Admin:
        pass

class Site(models.Model):
    name = models.CharField(maxlength=20)

    class Admin:
        pass
       
class Article(models.Model):
    headline = models.CharField(maxlength=50)
    reporter = models.ForeignKey(Reporter)
    pub_date = models.DateField()
    sites = models.ManyToManyField(Site)
   
    class Admin:
        pass

I can load data via the admin interface.  The problem is when I try to 
access an Article's sites-
   In [4]: a1 = Article.objects.all()[0]
   In [5]: a1
   Out[5]: <Article: Article object>
This all looks good but when I try to access sites-
   In [6]: a1.sites.all()

    783         raise
    784     else: # No match found.
--> 785         raise TypeError, "Cannot resolve keyword '%s' into 
field" % name
    786
    787     # Check to see if an intermediate join is required between 
current_table

TypeError: Cannot resolve keyword 'article' into field

I tried running the unittests and everything is fine, so I can't figure 
out what the deal is.  I imagine it's something really simple.

Any help would be appreciated.

Thanks,
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