Hi,
I`m trying to create a message which uses some kind of pluralization. The message look like this and depends on the number of deleted objects.
Successfully deleted [number of objects] Contact(s)
Thus output can be:
Successfully deleted 1 Contact Successfully deleted 5 Contacts
To achieve this task i followed the pluralization documentation which i referenced below:
My code in the view:
count = returned_objects.count()
if count == 1:
name = model._meta.verbose_name
else:
name = model._meta.verbose_name_plural
text = ungettext(
'Successfully deleted %(count)d %(name)s .',
'Successfully deleted %(count)d %(name)s .',
count
) % {
'count': count,
'name': name
}
print text
My code in the model:
class Meta:
verbose_name = _('contact')
verbose_name_plural = _('contacts')
The result is now "Successfully deleted 1 django.utils.functional.proxy object at 0x014D9B70"
I`m wondering why I do not get the verbose_name as output. Instead i get django.utils.functional.proxy object as the output for name.