On May 19, 5:03 am, Daemoneye <eternalstrikefree...@hotmail.com> wrote: > > class People(forms.Form): > HoldComments=models.ManyToManyField('Comment') > class Comment(forms.Form): > CommentWord=models.CharField(max_length=10000) > > I've had these two tables, I'd want the people make a comment so I new > p=comment(CommentWord=Comment)in the view > > but how can I save this tuple p of the comment to the People.HoldComment? > I can do it in the admin.But how can I do this job by the Django sentense? > > thanks for helping me >
This has nothing to do with tuples. 'p' is not a tuple, but an instance of Comment. h = HoldComment.objects.get(pk=mypk) h.HoldComments.add(p) (You may also want to take a look at PEP8 regarding the naming of your models and fields.) -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.