Hi Chris, On Mon, 2006-05-15 at 20:44 -0500, Chris Moffitt wrote: > 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()
Cutting and pasting your code into a clean project directory with the same Django code revision as yours, this all works for me. So, as you suspect, the problem is not with your code as written. Can you try the same experiment: start a new app and cut and paste the code as written here. Then run syncdb, etc. Just to check there is nothing weird about your current code files. > > 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 This is confusing, because it would indicate that the internal model representation is somehow out of whack. This is all being done by looking through Python lists, etc, that were created when the class was instantiated. There's no database activity or anything going on. I'm really at a loss to explain this. Will be most interested to see if a cut-and-paste duplication can repeat the error for you. Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---

