On Jul 13, 4:02 pm, janedenone <janeden...@googlemail.com> wrote: > Hi, > > I read the documentation on customizing admin templates, but I still > wonder how to access the object attributes in the change_form.html. I > am capable of getting the id using {{ object_id }}: > > {% if change %}{% if not is_popup %} > <ul class="object-tools"> > <li><a href="/booking/{{ object_id }}/view_calculation" > class="historylink">{% trans "View Calculation" %}</a></li> > ... > > but I need to access a couple of other attributes. {{ object_name }} > does not work, nor does {{ object_cottage_name}} for getting a related > object's name. > > Thankful for any hint. > > - Jan
The syntax for looking up attributes - in templates just like in Python - is a dot, not an underscore. So you should use object.name, etc. -- DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---