Tim, thanks for your help!
Also, I've found another solution for this problem:
http://stackoverflow.com/questions/6241906/display-number-of-instances-for-each-model-in-djangos-admin-index
On 5 июн, 16:50, Tim Shaffer wrote:
> You could probably do it using a signal. Every time a record is created
You could probably do it using a signal. Every time a record is created or
deleted, you can update the verbose_name_plural with the current count.
from django.db.models.signals import post_save, post_delete
def update_verbose_name(sender, **kwargs):
Elephant._meta.verbose_name_plural = 'elep
Hi, I need to display number of objects at main django site admin
page.
For example, in list of models I need to display
Elephants (6)
instead of
Elephants
I added this code to my model:
class Elephant(models.Model):
class Meta:
verbose_name_plural = 'Elephant ' + '(' +
unicod
3 matches
Mail list logo