hamidfzm
hamidfzm

Reputation: 4695

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?

Upvotes: 0

Views: 217

Answers (1)

Omid Raha
Omid Raha

Reputation: 10680

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)

Upvotes: 1

Related Questions