In model form phones field would be represented as CommaSeparatedInput and
workdays as multiple checkboxes:

classCompanyForm(forms.ModelForm):classMeta:model=Company

A handy @cached_property utility:

classUserProfile(models.Model):phones=models.ManyToManyField(Phone)...@cached_propertydefpublic_phones(self):# this queryset will be constructed only once, thanks to @cached_propertyreturnself.phones.filter(public=True)

A bunch of database querying utilities to not tinker with cursor() anymore:

best_offer=fetch_val('select max(value) from offers where ...')forrowinfetch_named('select * from blog_post'):printrow.id,row.title

And a middleware to make your html output slimmer by stripping out unnecessary spaces: