[Fixed]-How to add and save non model properties to Django forms?

1👍

I don’t think your model setup would make the EmployeeForm recognize the phone field, so you need to save it manually:

# in views.py
if employee_form.is_valid():
    new_employee = employee_form.save(commit=False)
    new_employee.phone = employee_form.cleaned_data['phone']
    new_employee.save()

Leave a comment