Hi all,

I got a form where i use a manytomany field likes this


kleurogen = models.ManyToManyField(Keuzes, blank=True, null=True)

This works fine but takes all the results from Keuzes
How can i only get the results from Keuzes that have the groep 'kleurogen'

i tried this but it doesnt work

kleurogen = models.ManyToManyField(Keuzes.objects.filter(groep_id=
"kleurogen"), blank=True, null=True)

AssertionError: ManyToManyField([<Keuzes: Blauw>, <Keuzes: Paars>]) is 
invalid. First parameter to ManyToManyField must be either a model, a model 
name, or the string 'self'

How can i do this?


in Keuzes i have

class Keuzes (models.Model):

    name = models.CharField(max_length=255)

    groep = models.ForeignKey(Keuzegroepen)

    

    def __unicode__(self):

        return self.name


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to