1

I have two CreateViews client and company. I am trying to add a client from the company create page. I thought i would just be able to change the action in the form tag to point to the client url. Nothing happens though when i click submit.

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 = [...]

create-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>
Mantis
  • 1,207
  • 2
  • 17
  • 44
  • Where is the logic to create the client? or to associate it to a company? you should also have a models.py – acostela Sep 02 '15 at 09:27
  • If this is your template, than reason is that you simply [can't have nested forms](http://stackoverflow.com/questions/379610/can-you-nest-html-forms). – beezz Sep 02 '15 at 09:30

0 Answers0