简体   繁体   中英

How to view recently client created records in django admin?

Is there any way to see recently added records as a notification in django admin? I googled but I didn't find any thing special. For example in your site you have Contacts page and each time you login to your admin panel you see notifications about new Contact model records?? Any idea how to do that?

I think, you can use django-admin-notifications module for that.

Install and configure it for your project.

Then define a new notifications.py file in Contacts app like this:

import admin_notifications
from models import Contacts
def notification():
    count = Contacts.objects.filter(status=Contacts.STATUS_NEW).count()
    if count:
        return 'You have {} new contacts <a href="/admin/contacts/">message</a>'.format(count)
    else:
        return ''

admin_notifications.register(notification)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM