I built a listview which works fine and gives me exactly what I want.
In the template of this ListView I declared a form that points to a CreateView. The form is like so,
{% if user.is_authenticated %}
<form action="{% url 'post_wall' %}" method="POST">
{% csrf_token %}
<input type='text' name='body' />
<input type='hidden' name='from_user' value='{{ user.id }}' />
<input type='hidden' name='to_user' value='{{ to_user }}' />
<input type='submit' value='POST'/>
</form>
{% endif %}
the post_wall url corresponds to
url(r'accounts/post_wall', WallCreate.as_view(), name='post_wall'),
The url which contains the form is
url(r'accounts/wall/(?P<slug>\w+)/$', WallList.as_view(), name='wall'),
This calls the CreateView,
class WallCreate(CreateView):
model = WallPost
def get_success_url(self):
url = reverse('wall', kwargs={'slug': request.POST.to_user})
return HttpResponseRedirect(url)
This gives me a
TemplateDoesNotExist at /accounts/post_wall
users/wallpost_form.html
Shouldn't this be working properly as a post is sent to a CreateView? Or have I misunderstood something about CBVs?