In my project, users can have any number of 'contact ways' with them. For example one user can have only mobile defined and the other can have mobile, mail, Skype and some other. There should be possibility to set for every user only one main 'way of contact', so I created model like below:
class Account(AbstractNamedUser):
....
class Contact(models.Model):
account = models.ForeignKey(Account)
value = models.CharField(max_length=100)
is_default = models.BooleanField(default=False)
In admin backend I'm using admin.TabularInline
for it, but unfortunately is_default
fields are independent checkboxes between each inline form. What I'd like to have is to change them into radio buttons and of course only one 'row' can be default.
I've tried formfield_overrides
, some ModelAdmin.form
or widgets = {'is_default':forms.RadioSelect }
but they work correctly only for choice fields in single form.
Is there any possibility of indicating in Django that field is_default
should be treated as radio button between inline forms?