ModelChoiceField in ModelForm passes None

I’m very new to Django.
I’m making form to add timetable to specific branch.
So I have ‘Branch’ model and ‘Timetable’ model.
‘Branch’ model is in ‘branches’ app and ‘Timetable’ model is in ‘schedules’ app.
What I’m expecting is when users fill in the form to add timetable, they can choose which branch to add it from select box.

Error message is this.
Error message from Django debug mode

Here is my codes
branches/models.py

from django.core.validators import RegexValidator
from django.db import models
from django.urls import reverse

# Create your models here.
phone_validator = RegexValidator(
    regex="\d{2,4}-?\d{3,4}(-?\d{4})?",
    message="It's not correct phone number format.",
)


class Branch(models.Model):
    srl = models.BigAutoField(primary_key=True, verbose_name="Serial")
    name = models.TextField(verbose_name="Branch name")
    postcode = models.CharField(max_length=5, verbose_name="Postcode")
    address1 = models.TextField(verbose_name="Road address")
    address2 = models.TextField(verbose_name="Detail address", blank=True)
    phone1 = models.CharField(max_length=13, validators=[phone_validator], verbose_name="Phone 1")
    phone2 = models.CharField(max_length=13, validators=[phone_validator], verbose_name="Phone 2", blank=True)
    is_opened = models.BooleanField(default=True, verbose_name="Is opened?")

    class Meta:
        verbose_name = "Branch"
        verbose_name_plural = "Branches"
        ordering = ["srl"]

    def __str__(self):
        return self.name

    def get_absolute_url(self):
        return reverse("branches:detail", kwargs={"srl": self.srl})

schedules/models.py

import datetime

from django.conf import settings
from django.db import models


class Timetable(models.Model):
    srl = models.BigAutoField(primary_key=True, verbose_name="Serial")
    branch_srl = models.ForeignKey(
        "branches.Branch",
        on_delete=models.CASCADE,
        verbose_name="Branch Serial",
    )
    period = models.DecimalField(
        max_digits=2,
        decimal_places=0,
        verbose_name="Period",
    )
    period_length = models.DurationField(
        default=datetime.timedelta(minutes=50),
        verbose_name="Period Length",
    )
    is_holiday = models.BooleanField(default=False, verbose_name="Is holiday?")
    start_time = models.TimeField(default=datetime.time(10, 00), verbose_name="Start time")
    end_time = models.TimeField(default=datetime.time(23, 00), verbose_name="End time")

schedules/forms.py

from django import forms
from django.forms import ModelChoiceField, ModelForm

from branches.models import Branch
from schedules.models import Schedule, Timetable


class TimetableForm(ModelForm):
    branch_choices = ModelChoiceField(
        queryset=Branch.objects.all(),
        required=True,
        label="Branch",
        widget=forms.Select(attrs={"class": "form-select"}),
    )

    class Meta:
        model = Timetable
        fields = (
            "branch_choices",
            "period",
            "period_length",
            "is_holiday",
            "start_time",
            "end_time",
        )
        labels = {
            "period": "Period",
            "period_length": "Period Length",
            "is_holiday": "Is Holiday?",
            "start_time": "Start Time",
            "end_time": "End Time",
        }
        widgets = {
            "period": forms.NumberInput(attrs={"class": "form-control"}),
            "period_length": forms.TimeInput(
                format="%H:%M:%S",
                attrs={
                    "class": "form-control",
                },
            ),
            "is_holiday": forms.RadioSelect(
                choices=[(True, "Yes"), (False, "No")],
                attrs={
                    "class": "form-check-input",
                },
            ),
            "start_time": forms.TimeInput(
                attrs={
                    "type": "time",
                    "class": "form-control",
                },
            ),
            "end_time": forms.TimeInput(
                attrs={
                    "type": "time",
                    "class": "form-control",
                },
            ),
        }

schedules/views.py

from django.apps import apps
from django.urls import reverse_lazy
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from django.views.generic.list import ListView

from schedules.forms import TimetableForm
from schedules.models import Schedule, Timetable


# Create your views here.
class AddTimetableView(CreateView):
    model = Timetable
    form_class = TimetableForm
    # This should be changed. This is temporary
    success_url = reverse_lazy("schedules:index")

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context["page_title"] = "Add timetable"

        return context

schedules/templates/scheduels/timetable_form.html
For your information, I’m using Bootstrap 5 and related CDN link is in main/base.html

{% extends "main/base.html" %}
{% load static %}
{% block content %}
    <form action="" method="POST" id="timetable-form" class="container d-grid gap-3 justify-content-evenly align-items-center">
        {% csrf_token %}
        {{ form.non_field_errors }}
        <div class="row">
            <label class="col-3 col-form-label text-nowrap" for="{{ form.branch_choices.id_for_label }}">{{ form.branch_choices.label }}</label>
            <div class="col">{{ form.branch_choices }}</div>
            {{ form.branch_choices.errors }}
        </div>

        <div class="row">
            <label class="col-3 col-form-label text-nowrap" for="{{ form.period.id_for_label }}">{{ form.period.label }}</label>
            <div class="col">{{ form.period }}</div>
            {{ form.period.errors }}
        </div>
        
        <div class="row">
            <label class="col-3 col-form-label text-nowrap" for="{{ form.period_length.id_for_label }}">{{ form.period_length.label }}</label>
            <div class="col">{{ form.period_length }}</div>
            {{ form.period_length.errors }}
        </div>
        
        <div class="row">
            <label class="col-3 col-form-label text-nowrap" for="{{ form.is_holiday.id_for_label }}">{{ form.is_holiday.label }}</label>
            <div class="col">
                {% for choice in form.is_holiday %}
                    <div class="form-check">
                        {{ choice.tag }}
                        <label class="form-check-label" for="{{ choice.id_for_label }}">{{ choice.choice_label }}</label>
                    </div>
                {% endfor %}
            </div>
            {{ form.is_holiday.errors }}
        </div>
        
        <div class="row">
            <label class="col-3 col-form-label text-nowrap" for="{{ form.start_time.id_for_label }}">{{ form.start_time.label }}</label>
            <div class="col">{{ form.start_time }}</div>
            {{ form.start_time.errors }}
        </div>
        
        <div class="row">
            <label class="col-3 col-form-label text-nowrap" for="{{ form.end_time.id_for_label }}">{{ form.end_time.label }}</label>
            <div class="col">{{ form.end_time }}</div>
            {{ form.end_time.errors }}
        </div>
        
        <div class="row">
            <div class="col d-flex justify-content-end">
                <button class="btn btn-primary" type="submit">저장</button>
            </div>
        </div>
    </form>
{% endblock %}

The error is saying that the field branch_srl is null when it’s being inserted so it violates the NOT NULL CONSTRAINT. If you check your form, the form doesn’t use that field, but instead it uses branch_choices. You need to map the selected value for that field to branch_srl somewhere. It can be in TimetableForm.save(), AddTimetableView.form_valid() or you could rename the field branch_choices to branch_srl so it saves through to the database.

Wow, thanks.
I thought if I use same name with the model might cause error.