django: Two generic view in same template -
i need advice generic views , template in django. trying figure out how it's works.
i want implement 1 page display 2 generic view createview , deleteview.
for example:
models.py
class model(models.model): name = models.charfields(u'name', max_length=30, null= true, unique= true)
how can make 1 form create object, , in same template below create form render table exist objects , use checkbox column option delete object.
both of forms should consists button submit action (delete, add)
tnx
in urls.py
from appname.models import model django.views.generic import list_detail interface_info={ 'queryset': model.objects.all(), 'template_name': 'template/interface.html' } url(r'^template/interface/$',list_detail.object_list,interface_info),
in template/interface.html
<form action="template/add/" method="get"> <input type="text" name="name"/> <input type="submit"> </form> <form action="template/delete/" method="get"> {% in object_list %} {{a.name}} <input type="radio" name={{a.name}}/> <br/> {% endfor %} <input type="submit"/> </form>
your form ready.
Comments
Post a Comment