Tuesday, June 27, 2017

Help with styling: form for a many-to-many inline admin

I am trying to improve the appearance of the inline editing appearance for a many-to-many field in the Django (1.10) admin .

The parent model contains the link:

class Sample(models.Model):
    id = models.AutoField(primary_key=True)
    # ...
    objectives = models.ManyToManyField(
        SampleObjective,
        related_name='sample_objectives',
        verbose_name=_('required objectives'))

In the admin:

class SampleObjectiveInline(admin.TabularInline):
    model = models.Sample.objectives.through
    exclude = ('objectives', )


class SampleAdmin(admin.ModelAdmin):
    # ...
    inlines = (SampleObjectiveInline, )




The image (above) shows that the default text for the section name, as well as the labels, is not very user-friendly. How do I alter/overwrite these?

Thanks
Derek

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1Wu3Pt_%2BHJn4GkT9ukDMrCcmf8Dguimk_k3rk_xcqYS9YCAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment