I'm reading through the djangobook and trying to build a small app as
I go. The app is just a list that I can add to and delete entries
from. Deleting is easy, but I'm not sure how the url/view portion
should be handled.

http://127.0.0.1:8080/lists/show/

list item 1 - [delete]
list item 2 - [delete]
list item 3 - [delete]

When an item is deleted, I would just like it to return to the same
url. The way I'm seeing to do it would leave a somewhat ugly and
irrelevant url (lists/delete/item1) while viewing the list. What's a
more proper way to do this?

#urls.py

urlpatterns = patterns('',
        (r'^lists/show/$', showItems),
        (r'^lists/delete/([^/]+)$', deleteItem)
)


#views.py

def showItems(request):
    # get the items from the model
    return render_to_response('lists/show.html', {'items':items})

def deleteItems(request, item):
    # delete the item
    return render_to_response('lists/show.html', {'items':items})

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

Reply via email to