On May 19, 5:03 am, Daemoneye <[email protected]>
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 [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.

Reply via email to