Hi,
 
I created 2 objects as following:
 
class Author(models.Model):
name = models.CharField(maxlength=200)
class Admin:
ordering = ['-name']
def __str__(self):
return self.name
 
class Album(models.Model):
name = models.CharField(maxlength=200)
author = models.ManyToManyField(Author)
class Admin:
ordering = ['-name']
def __str__(self):
return self.name
 
while i was trying to append an album object into database like that,
def register(request):
    name = request.POST['name']
    author = request.POST['author']
    album = request.POST['album']
    if author:
        objauthor, created = Author.objects.get_or_create(name=author)
        if album:
             objalbum, created = Album.objects.get_or_create(name=album, author=objauthor)
 
I received error message:
Exception Type: TypeError
Exception Value: 'author' is an invalid keyword argument for this function
 
Does any on knows how to append an ManyToManyField?
Thanx!
 
Minglei
 

--~--~---------~--~----~------------~-------~--~----~
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