Friday, March 17, 2017

Re: Tweaking the admin title to display the model name

On 17/03/2017 7:49 PM, Andréas Kühne wrote:
> You can override the admin change form for the model you want and then
> change the title.
>
> You can check here for some information:
> https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#overriding-admin-templates

That's fantastic! Thanks Andréas ... here's the entire change in 2 lines:

{% extends "admin/change_form.html" %}
{% block title %}{{ original }}{% endblock %}

:-)

Cheers

Mike

>
> Regards,
>
> Andréas
>
> 2017-03-17 5:21 GMT+01:00 Mike Dewhirst <miked@dewhirst.com.au
> <mailto:miked@dewhirst.com.au>>:
>
> Currently in an admin model change form, the admin page title is
> "Change <verbose_name_plural>"
>
> How can I tweak the code or the template so it displays an
> attribute of the model instance instead?
>
> I'm trying to work on a few instances at the same time and having
> the model instance identifier would be very useful.
>
> Thanks
>
> Mike
>
> --
> 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
> <mailto:django-users%2Bunsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bf52e2be-f042-dc0f-9e76-86a9ad62d6fc%40dewhirst.com.au
> <https://groups.google.com/d/msgid/django-users/bf52e2be-f042-dc0f-9e76-86a9ad62d6fc%40dewhirst.com.au>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> 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
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/CAK4qSCc%2B3a-nSy_s7_TDLw5EJRaRHpWcpW-SfFZVSR%2B%2BmJNeng%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAK4qSCc%2B3a-nSy_s7_TDLw5EJRaRHpWcpW-SfFZVSR%2B%2BmJNeng%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
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/fa4bbf36-25a8-546b-817c-39756c889a8c%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment