How to set first default rows/values in django admin\'s inline?
class Employee(models.Model):
username = models.CharField(_(\'Username\'), max_length
To provide a static default for all instances in the inline, I found a simpler solution that just sets it in a form:
class DetailsForm(django_forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['label'] = 'first_name'
class DetailsInline(admin.TabularInline):
form = DetailsForm
# ...
I think this doesn't work for the OP's particular case because each form has a different value for the 'label'
field, but I hope it can be useful for anyone coming to this page in the future.