Yes, I've read http://code.djangoproject.com/wiki/NewbieMistakes

This is my URL list:

urlpatterns = patterns('',
        (r'^admin/', include('django.contrib.admin.urls')),
        (r'^settings/$','file.app.views.settings'),
        (r'^inbox/$','file.app.views.inbox'),
        (r'^sent/$','file.app.views.sent'),
        (r'^deletemessage/$','file.app.views.deletemessage'),
        (r'^compose/$','file.app.views.createmessage'),
        (r'^login/$','file.app.views.login'),
        (r'^formtest/$','file.app.views.formtest'),
        (r'^logout/$','file.app.views.logout'),
        (r'^msg/(?P<msg_id>\d+)/$','file.app.views.msg'),
        (r'^autologin/(?P<user_id>\d+)/$','file.app.views.autologin'),
)


I have an inbox template that generates a list of links to messages
with the necessary trailing slash like this:

<a class='msglink' href='/msg/34/'>blah blah</a>

That link takes you to the message view which has a form that looks
like this:

<form action='.' method='post'>
<input type='submit' value='Delete'>
</form>

I'm using the combined get/post approach in file.app.views.msg() but
when you click the 'Delete' button the request object passed to my
msg() method returns false when you evaluate request.POST, so the GET
view just gets rendered again.

I tried updating the GET template to hardcode the action part of the
form with a trailing slash instead of using "." like this:

<form action='/msg/{{msg.id}}/' method='post'>
<input type='submit' value='Delete'>
</form>

which generates HTML like this:

<form action='/msg/34/' method='post'>
<input type='submit' value='Delete'>
</form>

But that still results in request.POST being false when my msg() method
is called.  I put some debugging code in my msg() view like this:

def msg(request,msg_id):
    if request.POST:
        raise ValueError, 'It posted.'

But that exception never gets raised.

Am I missing something obvious, or is there more info I should provide?

I'm using Django-0.95-py2.3.egg.

Thanks in advance!

jacob


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to