我有一个客户端详细信息视图,其中包含客户端的各种信息,我想为其提供编辑选项,以便他们可以编辑客户端。
urls.py
url(r'edit/(?P<pk>[0-
9]+)/$',views.ClientInfoUpdate.as_view(),name='clientinfo'),
views.py
class ClientInfoUpdate(UpdateView):
model = ClientInfo
fields = '__all__'
template_name_suffix = '_update_form'
clinetinfo_update_form.html
<form class="form-horizontal" action="" method="post"
enctype="multipart/form-data">
{% csrf_token %}
{% include 'update/form-template.html'%}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-
success">Submit</button>
</div>
</div>
</form>
detail.html
<td><small></small><a href="{% url 'update:clientinfo' client.id %}">Edit Info</a></td>