CARVIEW |
Select Language
HTTP/2 200
server: nginx
content-type: text/html;charset=utf-8
cache-control: must-revalidate
expires: Fri, 01 Jan 1999 00:00:00 GMT
set-cookie: trac_form_token=0f131a092db56bef0f5b4e43; HttpOnly; Path=/; Secure
set-cookie: trac_session=391230fa75df2abe364c4d1d; expires=Tue, 21 Oct 2025 06:04:42 GMT; HttpOnly; Path=/; Secure
strict-transport-security: max-age=31536000; includeSubDomains; preload
permissions-policy: interest-cohort=()
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
accept-ranges: bytes
via: 1.1 varnish, 1.1 varnish
date: Wed, 23 Jul 2025 06:04:42 GMT
x-served-by: cache-fra-etou8220141-FRA, cache-bom-vanm7210076-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753250683.635565,VS0,VE332
vary: Accept-Encoding
LastUpdateContextProcessor – Django
Back to Top
Django
The web framework for perfectionists with deadlines.
Issues
Last update context processor
Here is a simple context processor that you can use to display the latest update to your site (using the history produced by the admin app).
def last_update(request): """Returns the last logged update with the admin.""" from django.contrib.admin.models import LogEntry try: entry = LogEntry.objects.all().order_by('-action_time')[0] except IndexError: entry = None return {'last_update': entry}
Once you have added this to TEMPLATE_CONTEXT_PROCESSORS in your settings.py, you can use the following in your templates:
Site last updated: <a href="{{ last_update.get_edited_object.get_absolute_url }}">{{ last_update.action_time|date:"j M Y" }}</a>
Last modified
19 years ago
Last modified on Sep 1, 2006, 1:46:05 AM
Note:
See TracWiki
for help on using the wiki.
Download in other formats:
Django Links
Learn More
Get Involved
Follow Us
- Hosting by In-kind donors
- Design by Threespot &
© 2005-2025 Django SoftwareFoundation unless otherwise noted. Django is a registered trademark of the Django Software Foundation.