Checkbox
record.full_timer = request.POST.get('full_timer', False)
if record.full_timer == 'on':
record.full_timer = True
record.save(update_fields=['full_timer'])
print('record updated')
In template
Number text
record.target = request.POST['target']
In template
Select
In View
context['languages'] = Language.objects.all()
In template
Select field choices with key values
In view
context['unit_choices'] = CompanyService._meta.get_field('unit').choices
In template
Set a field to NULL use None
if service:
record.service = CompanySubService.objects.get(company=1, name=service)
else:
record.service = None