Hi,
-- I have been working on a small project for myself and some friends, and I seem to have hit a hitch in getting it to work as expected.
In my detail view, I have a small simple form:
<form class="inline" action="/app/action/" method="POST">
{% csrf_token %}
<button type="submit">Prepare</button>
</form>
My main list view and detail view are class based views, with me attempting to use a FBV for prepare because it seems simpler to understand. I've put a breakpoint in the "action" view, and tried to inspect the request and see data from clicking the button come through, but I don't see it. I am clearly missing something about how django sends POST data. I have tried adding the following in bold to see how to get the data through, as well as adding *args, **kwargs, as well as positional and named keyword arguments to my "action" FBV:
<form class="inline" action="/app/action/" method="POST" id="{{ obj.id }}" objid="{{ obj.id }}">
{% csrf_token %}
{{obj.id}}
<input type="hidden" value="{{obj.id}}" />
<button type="submit">Prepare</button>
</form>
If anyone can explain what I'm missing, it'd be greatly appreciated!
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4beeade8-d1da-4d56-8cf5-9855d13eeb8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment