Ludovic, would you be so kind to help me and put together some example code 
of what I should  place in the forms.py and the views.py? I would greatly 
appreciate.

On Monday, May 2, 2016 at 4:25:13 PM UTC+6, ludovic coues wrote:
>
> You might want to add a foreign key in the answer model pointing to 
> the question. 
> Then in the view to show the form, create an answer object with it's 
> question FK assigned to the question and create a form from that 
> answer. In the view processing the form, you should get that object 
> back, with the question and the text filled. Complete it with the 
> user, as shown in the django girls tutorial and save your answer. 
>
>
>
> 2016-05-02 11:57 GMT+02:00 Said Akhmedbayev <[email protected] 
> <javascript:>>: 
> > Thank you ludovic and sorry for not being able to clearly explain what I 
> > want to do :-(. You are right, I want to show a user a simple django 
> form, 
> > but I cannot figure out how to save an individual answer alone with its 
> > correspondence question's id and user's id 
> > 
> > So my table for "Answer" model will look like: 
> > 
> > user_id       question_id             answer 
> >      01                    01                 text of an answer 
> >      01                    02                 text of an answer 
> >      02                    01                 text of an answer 
> >      02                    02                 text of an answer 
> >      03                    01                 text of an answer 
> >      03                    02                 text of an answer 
> > 
> > 
> > 
> > 
> > On Monday, May 2, 2016 at 3:25:06 PM UTC+6, ludovic coues wrote: 
> >> 
> >> I have some trouble trying to understand what you means by "content 
> type". 
> >> That terms refer to the content of a file. For exemple, text/plain for 
> plain 
> >> text file or image/png for an image encoded as png. 
> >> What you show look like a standard form. If you need basic pointer on 
> how 
> >> to use a form, saving it's data along with current logged-in user, you 
> might 
> >> want to have a look at the django girls tutorial. Specifically, 
> >> http://tutorial.djangogirls.org/en/django_forms/ is about django 
> forms. 
> >> 
> >> 2016-05-02 8:23 GMT+02:00 Said Akhmedbayev <[email protected]>: 
> >>> 
> >>> Avraham, I understand that the content type is not any special or 
> complex 
> >>> for you. Probably, I should wrote "complex content type for me". 
> Anyways, 
> >>> can you provide any instructions for how can make this kind of content 
> type? 
> > 
> > -- 
> > 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 [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/fdbc2c01-2059-406d-93fe-762d9fdc4a73%40googlegroups.com.
>  
>
> > 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
>
> Cordialement, Coues Ludovic 
> +336 148 743 42 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c96cece4-7a3b-45fc-bb6f-5dfdd1e1b242%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to