Tuesday, August 25, 2015

Re: Forms questions

I've realized that the action field in the form should be "/stats/submit/", the same view as the one that sent me to the template.  However, whenever I submit with the form then, it tells me that the file I submit is missing, even when it is definitely there.

On Tuesday, August 25, 2015 at 10:10:30 AM UTC-7, Hugo Kitano wrote:
Here it is, very simple:

<h1> Submit form: </h1>
<form action="/stats/" method="post">
    {% csrf_token %}
    {{ form.as_p }}
    <p><input type="submit" value="Submit" /></p>
</form>



On Monday, August 24, 2015 at 4:31:47 PM UTC-7, Sait Maraşlıoğlu wrote:
Can you provide the template code?


On Tuesday, 25 August 2015 00:16:40 UTC+3, Hugo Kitano wrote:
Hi, I'm trying to figure out what's wrong with my form:

I've noticed that every time I load my submit view, the request.method is GET not POST, so nothing gets saved to the database.


Here's views.py


models.py


Thanks!!

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5b3c906a-8902-41f4-82b6-e2140ac0efae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment