[Fixed]-Different models in one view

1👍

You are using the variable form in your template, but you are passing UserRegisterForm and ContactForm as template context.

Try something like:

<form...>

{{ UserRegisterForm }}
{% for form in ContactForm %}
{{ form }}
{% endfor %}
</form>

Two hints:

  • check out formsets for handling multiple forms of the same type
  • please make sure your code is correctly indented, especially with Python

0👍

You’ve sent two variables to your template, with the keys UserRegisterForm and ContactForm. You have to use those names in your template, not just form.

Leave a comment