Created
August 17, 2020 08:16
-
-
Save LowerDeez/8c373f81708900540570beb86c28bb31 to your computer and use it in GitHub Desktop.
Adding Counters to Models in the Django Admin Panel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.functional import lazy | |
from django.utils.translation import ugettext_lazy as _ | |
from knowledge.models import Article | |
class ModeratedArticle(Article): | |
class Meta: | |
proxy = True | |
verbose_name = _('Article') | |
verbose_name_plural = lazy(lambda: _('Articles ({})').format(ModeratedArticle.objects.to_moderation().count()), str)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment