Django inlineformset_factory

And to confirm, this element is the one that is rendering as an input field?

Side note: One issue I see is that you are rendering multiple Django forms or formsets within a single HTML form element. When you do so, you want to use the prefix attribute on your forms so that Django can properly organize the input fields.

I think so. I want it to be select - option field.

But that makes no sense.

The template context element department_form is an instance of DepartmentsForm - which means it’s intended to edit a particular instance of one Departments object. You’re not selecting an instance of Departments from the model.

(Also, in case we cross-posted here, please see the side note from my previous reply added.)

I get it. But without inlineformset_factory, it works like I showed you in snapshot. So is it impossible then ?

It’s not that it’s impossible, it’s that it’s meaningless, at least as you have it shown here.

What is the purpose of this form (DepartmentsForm) on this page?

Are you looking to change the name of the department, or are you looking to reassign the staff to a different department?

If you’re looking to change the name of the department, then what you have is correct, and it make no sense to try to make that a select list.

But if you’re looking to reassign a set of staff to a different department, then this shouldn’t be a model form. It should just be a ModelChoiceField field in the form, yielding a value to be used to assign to all instances of the Staff assigned to the current department.

What is the purpose of this form (DepartmentsForm) on this page?
=> To assign and reasign staffs when they get hired into their respective departments.
Are you looking to change the name of the department, or are you looking to reassign the staff to a different department?

=> Renaming the name of the department can easily be done through update_Department.view.