0

I am trying to add a link in the admin's html and It's pretty easy but I would like to add the filter date today on the link so that it would display all the info that has date today.

I have not tried anything yet as I am unsure where to start, or is it possible? I'll update if I found something.

Sayse
  • 42,633
  • 14
  • 77
  • 146
Juan Carlos Asuncion
  • 927
  • 2
  • 10
  • 26
  • read this http://stackoverflow.com/questions/6583877/how-to-override-and-extend-basic-django-admin-templates/17232425 – maazza Mar 02 '16 at 13:52

1 Answers1

0

You are probably looking for ModelAdmin.list_filter

In your admin.py add a list_filter for date:

class PersonAdmin(admin.ModelAdmin):
    list_filter = ('date',)
ilse2005
  • 11,189
  • 5
  • 51
  • 75
  • I have `list_filter`, but I am also using a notification app where it says what model has `date today` and is clickable and redirects it to the model that is already filtered – Juan Carlos Asuncion Mar 02 '16 at 14:02
  • Sorry, then I don't get your question. – ilse2005 Mar 02 '16 at 14:12
  • You can filter all the models via `list_filter` but I also want a clickable notification where on click it would redirect to the model with filter already set, sorry for not being clear, I do have the notification, I just need the filter part – Juan Carlos Asuncion Mar 02 '16 at 14:19
  • Something like this: http://stackoverflow.com/questions/2156114/how-do-i-add-a-custom-column-with-a-hyperlink-in-the-django-admin-interface – ilse2005 Mar 02 '16 at 14:22
  • A bit close to it, but not what I am looking for, thanks though – Juan Carlos Asuncion Mar 02 '16 at 14:37