K, I didn't want to go to bed without implementing some functionality, so I went ahead with my <a href> idea. This is what I implemented:
{% block options %} <p><a href="http://localhost:8000/sam/quote/ delete/{{ object.id }}">delete</a>{% endblock %} It works just fine, but it depresses me to think I need to be hardcoding these sorts of things when I'm sure there must be a cool django way of doing it. Any tips on more elegant ways of implementing this would be most welcome. Cheers, On Nov 26, 10:19 pm, dash86no <[EMAIL PROTECTED]> wrote: > I'm sorry to ask what I feel must be a simple question, but I've just > spent the last hour trawling through the documentation, and can't for > the life for me find out how to add a "delete button" to a form. > > I've set up a generic view: > > (r'^quote/delete/(?P<object_id>\d+)/$', > 'django.views.generic.create_update.delete_object', dict(quote_info, > post_delete_redirect='/sam/')), > > Which I've tested and seems to be working ok. (The documentation, by > the way, didn't mention anything about requiring > foo_confirm_delete.html but I guess that's not too hard to figure out > from the error message) > > The thing is, I want to work out how to add a delete button to my: > > (r'^quote/(?P<object_id>\d+)/$', > 'django.views.generic.create_update.update_object', dict(quote_info, > post_save_redirect='/sam/')), > > Now I understand that I must edit the template to make this happen. > The thing is, and to give you some insight on the challenges for a > noob to web development, I'm never sure when I should be using django/ > python and when I need to use good old fashioned HTML. > > I could I suppose fairly easily stick a link on the template that > redirects to my generic delete URL. However, one of my aims with this > project is to try to do everything as intelligently as possible, so I > wonder if there is any way I can include django save and add another/ > delete/cancel widgets onto the form automatically? > > I'll eventually be wanting to put those "edit in line" green cross > buttons onto foreign key input fields too, so I'm thinking django must > have a standard sort of widget set to allow this? > > Cheers, --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---