Skip to content

Instantly share code, notes, and snippets.

@walison17
Created July 14, 2020 14:27
Show Gist options
  • Save walison17/c14735ec1d5076e8075ab9cc3364bf5e to your computer and use it in GitHub Desktop.
Save walison17/c14735ec1d5076e8075ab9cc3364bf5e to your computer and use it in GitHub Desktop.
def client_create(request):
if request.method == "POST":
user_form = UserForm(request.POST)
client_form = ClientForm(request.POST)
if user_form.is_valid() and client_form.is_valid():
user = user_form.save()
client = client_form.save(commit=False)
client.user = user
client.save()
return redirect(client)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment