Ошибка при сохранение данных формы Django

Код ошибки

django.db.utils.IntegrityError: NOT NULL constraint failed: movies_ticket.ticket_in_city_id

models.py

class Ticket(models.Model):
    creater = models.ForeignKey(User, on_delete=models.CASCADE)
    start_date = models.DateField(blank=True, default=date.today)
    end_date = models.DateField()
    ticket_in_city = models.ForeignKey(Region, on_delete=models.CASCADE)
    date_created_ticket = models.DateTimeField(default=timezone.now)

forms.py

class TicketForm(forms.ModelForm):
    class Meta:
        model = Ticket
        fields = ['start_date', 'end_date', 'ticket_in_city ']
        widgets = {
            'ticket_in_city ': autocomplete.ModelSelect2(),
            'start_date': DatePickerInput(format='%Y-%m-%d'),
            'end_date': DatePickerInput(format='%Y-%m-%d'),
        }

views.py

def create_ticket(request):
    if request.method == 'POST':
        ticket = TicketForm(request.POST, instance=request.user)
        if ticket.is_valid():
            ticket = Trip(creater=request.user, start_date=request.POST.get('start_date'),
                    end_date=request.POST.get('end_date'))
            ticket.save()
            messages.success(request, f'Ticket created.')
            return redirect('main-page')
    else:
        trip = TicketForm()
    return render(request, 'ticket/index.html', {'ticket_form': ticket})

Ответы (1 шт):

Автор решения: goodyonz

Пропустил важный момент с cleaned_data

def create_ticket(request):
if request.method == 'POST':
    ticket = TicketForm(request.POST, instance=request.user)
    if ticket.is_valid():
        ***ticket_number = ticket.cleaned_data['ticket_in_city']***
        ticket = Trip(creater=request.user, start_date=request.POST.get('start_date'),
                end_date=request.POST.get('end_date'), ***ticket_in_city=ticket_number*** )
        ticket.save()
        messages.success(request, f'Ticket created.')
        return redirect('main-page')
else:
    trip = TicketForm()
return render(request, 'ticket/index.html', {'ticket_form': ticket})
→ Ссылка