我有两个CreateViews
客户和公司。我正在尝试从公司创建页面添加客户端。我以为我只能将表单标记中的action
更改为指向客户端URL。当我点击提交时没有任何反应。
urls.py
url(r'^clients/create/$', ClientCreate.as_view(success_url="/app/clients/"), name='clients-create'),
url(r'^company/create/$', CompanyCreate.as_view(), name='company-create'),
views.py
class ClientCreate(CreateView):
model = Client
fields = [...]
class CompanyCreate(CreateView):
model = Company
fields = [...]
创建-company.html
<form role="form" method="post" action="."> {% csrf_token %}
<a (Link to popup form)>+</a>
<form role="form" method="post" action="client/create/">{% csrf_token %} </form>
</form>