Django. Invalid keyword argument for this function. ManyToMany
Posted
by
sagem_tetra
on Stack Overflow
See other posts from Stack Overflow
or by sagem_tetra
Published on 2012-10-30T16:59:03Z
Indexed on
2012/10/30
17:00 UTC
Read the original article
Hit count: 137
django
I have this error:
'people' is an invalid keyword argument for this function
class Passage(models.Model):
name= models.CharField(max_length = 255)
who = models.ForeignKey(UserProfil)
class UserPassage(models.Model):
passage = models.ForeignKey(Passage)
people = models.ManyToManyField(UserProfil, null=True)
class UserProfil(models.Model):
user = models.OneToOneField(User)
name = models.CharField(max_length=50)
I try:
def join(request):
user = request.user
user_profil = UserProfil.objects.get(user=user)
passage = Passage.objects.get(id=2)
#line with error
up = UserPassage.objects.create(people= user_profil, passage=passage)
return render_to_response('thanks.html')
How to do correctly?
Thanks!
© Stack Overflow or respective owner