Why am I not able to save the form data in Django?
-
I am not able to save the form data http://views.py @login_required def crave_view(request, id): crave = get_object_or_404(CraveData, pk=id) check = Comment.objects.filter(crave=http://crave.id) print check if request.method=="POST": form=CraveReplyForm(request.POST, request.FILES) if form.is_valid(): reply = form.save(commit=False) reply.person=request.user reply.person=request.cravedata reply.crave = crave reply.save() else: form=CraveReplyForm() return render(request, "crave/Comment.html", {'crave': crave, 'form' : form, 'check':check}) http://url.py url(r'^reply_get/(?P<id>.*)$', 'crave_view'), comment.html <form class="horizontal-form" role="form" action="/comment/reply_get/{{http://crave.id}}" method="post" style="padding: 10px;"> {% csrf_token %} <div class="form-group" > <div class="col-sm-10"> {{ form.reply.label_tag }} {{ form.reply }} </br> </br> </div> </div> <input type="submit" class="btn btn-success" value="reply" /> </form> http://forms.py class CraveDataForm(forms.ModelForm): class Meta: model = CraveData exclude=['date', 'password1', 'password2', 'username', 'person'] I am getting id in url but reply is not getting saved to backend. Getting the error as " return int(value)" I dont know what wrong i am doing, please help me out. I want to save the reply to backend.
-
Answer:
They have a website for these queries , and its called "stackoverflow".
Anonymous at Quora Visit the source
Related Q & A:
- Why am I not able to retrieve offline messages?Best solution by Yahoo! Answers
- Why am i not able to do voice chat with the new downloaded Yahoo messenger?Best solution by Yahoo! Answers
- Why am I not able to connect with the Yahoo Messenger?Best solution by Yahoo! Answers
- Why am I not able to send SMS using Yahoo Messenger?Best solution by Yahoo! Answers
- Why am I not able to access my yahoo mail after I login in?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.