On Mon, Apr 20, 2009 at 7:48 PM, [email protected] <[email protected]> wrote: > > I'm trying to manually create an object (from a signal). My problem is > that the object has a 'sites' M2M field: > > class News_item(models.Model): > ... > sites = models.ManyToManyField(Site) > ... > > but when I try to create the object: > > news = News_item( > ... > sites = site, > .. > ) > > I'm getting a type error > TypeError: 'sites' is an invalid keyword argument for this function > > What am I doing wrong here?
Try: news = News_item(...) news.sites.add(site) http://docs.djangoproject.com/en/dev/ref/models/relations/#ref-models-relations Regards, Daniel --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---

