# How to change a form name in class based view?

**URL:** <https://forum.djangoproject.com/t/how-to-change-a-form-name-in-class-based-view/42896>\
**Category:** Forms & APIs\
**Created:** [September 21, 2025, 10:27am UTC](https://forum.djangoproject.com/t/how-to-change-a-form-name-in-class-based-view/42896 "2025-09-21T10:27:57Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 21, 2025, 5:22pm UTC](https://forum.djangoproject.com/t/how-to-change-a-form-name-in-class-based-view/42896/11 "2025-09-21T17:22:08Z")

</div>

If the section of the template that includes these lines:

> [@FireDragon42](#):
>
> ```auto
> <div class="form-element-group">
> <label for="{{ form.familyName.id_for_label }}">{% translate "full name"%}</label>
> <span>
> {{ form.firstName }}
> {{ form.nameAffix }}
> {{ form.familyName }}
> </span>
> 
> ```

Is what’s in one of the `include` directives, perhaps:

> [@FireDragon42](#):
>
> `{% include "MyNetwork/form/person/full_name_fields_form.html" %}`

Then keep in mind that you can assign a name to a context reference in the include statement with the `with` directive. See [include](https://docs.djangoproject.com/en/5.2/ref/templates/builtins/#include).

This means you can do something like:  
`{% include "MyNetwork/form/person/full_name_fields_form.html" with form=form_1 %}`  
and  
`{% include "MyNetwork/form/person/full_name_fields_form.html" with form=form_2 %}`

where references to `form` within the `full_name_fields_form.html` template are referring to the context entries `form_1` and `form_2` respectively.

The templating system is very much designed around being flexible and used in a “generic” manner. Look at the system provided templates for things like the admin and the standard widgets to get some ideas as to just how flexible they can be.

And so the reason I recommend going with option 1 above is that learning how to create and use these types of generic templates goes a long way toward reducing duplicated functionality.

Now, having said all this, I will point out that the Django-provided CBVs are _not_ a good solution for “multiple-form” views. Yes, they can be adapted to handling multiple forms, but it’s not really what they’re designed to do and you end up having to override more functionality than you might like to ensure that _both_ forms are handled properly.

If you have multiple views where each view is having to properly manage multiple forms, my suggestion is to either use FBVs - or if you have enough of these where it’s worthwhile to do so, create your own CBVs starting from `View`.

---

_[View the full topic](https://forum.djangoproject.com/t/how-to-change-a-form-name-in-class-based-view/42896)._
