Django, Overriding behavior Admin Model - django

in the django admin, in any app model, the diplay data (datagrid o view template, i dont know how call it), django show "all" the entry, but what happen if i want that django just show the entry with statu live or x status and not all entry with any status?.
how, overriding initial behavior in admin model?
Thanks

Here's the same question with some answers.

Related

When overriding change_form.html template in Django Admin, the breadcrumb for its model listview is grayed out and unclickable

For some reason when overriding the change_form.html template in Django Admin, its associated listview breadcrumb is grayed out and you can't click on it. Does anyone know how to make it available again? Thank you.
It turns out that #Dev use django v1.11 and template is from django v.2.2.
In new template, django use has_view_permission to determine if user is able to access model page in admin panel. However, in django 1.11 there was no view permission and no has_view_permission method, thus it was rendered gray.

In django, can I show post's permalink in admin page?

I have a model called Post for my Blog application in Django. I have a slug field that is prepopulated by the title field. (I also use the get_absolute_url method, if that matters). What I want is to be able to see the permalink, of course without being able to edit it! Just readonly. I also believe that this field will be empty when I create a post, so only visible-active when I update a post.
Thanks in advance.

Admin Page in Django

I want to check about some field in Django if the DB Contains the same value for it before make ADDITION in the admin page . and if there is any field with the same value a message will be appear, then the admin will take a decision if he wants to add or not.
and i dont want to make these field UNIQUE.
is it possible?

How to modify the way a ForeignKey field is rendered in a Django admin page to avoid browser crash?

I have a Customer model which contains a ForeignKey to a Contact model.
I have over 100,000 contacts in my DB and when I load the admin page for a specific customer, the dropdown menu for the contact is getting populated with ALL of the contacts in the database. This has recently, due to its shear length, started causing my Firefox to crash while the admin page is loading.
Is there a way to either:
replace the field with an integer
field I can manually modify to the
contact ID when necessary
replace the dropdown menu with some
alternative input method which won't
crash the browser
remove this input
from the Customer admin page
altogether
Thanks!
You can do any of the either of things you want to.
Simplest solution is the exclude the field from the admin. Just say so in the admin class.
You can change the field to be text input and display it's primary key rather than the item itself, by including it in the raw_id_fields of the admin class.
You can also replace the standard dropdown widget with the Auto complete text field input. Use the implemented widget, or other equivalents. - This is probably the solution you like the best.
You can also override the formfield_for_foreignkey method on the Admin model to customize the queryset that gets displayed in the foreign-key dropdown. You may want to checkout my implementation for displaying only the current User's (or subdomain's) added entities.
Sounds like specifying the contact field in raw_id_fields in your admin.py entry for the relevant model would sort you out. Docs are here.
PS. Surprised (but not that surprised) that FF gives out before your database server tanks...

Does Django admin provide group edit of models?

For instance, I have a model called Person, and it has a bool field called 'isAthlete'. I would like to be able to check off True for 50 of these Person records, and then hit submit, without having to go into each Person model record and make the change. Is there an easy or already provided way to set this up in Django?
you can do this using django admin actions, http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/