updating the Meta class attributes at will

35 views
Skip to first unread message

Frank Gwada

unread,
Jan 15, 2018, 11:06:18 AM1/15/18
to Django developers (Contributions to Django itself)
I have an AbsrtractBase class mode with a class Meta and I want it in such a way that a user when setting up can be able to update or change the verbose_name in the Meta class is this possible?

what I have so far
class AbstractBase(models.Model):
   ......
   custom_name = models.CharField(blank=True)

   def update_verbose_name(self, custom_name):
try: if self.custom_name is not None:
return self.custom_name
else: self.custom_name = self.__class__.__name__
return self.custom_name
except Exception as error: return str(error)
class Meta(object): abstract = True
      verbose_name = self.custom_name
 

but the issue is that I cannot access the self.custom name variable

is there any other solution that I can achieve what I'm intending to do



Reply all
Reply to author
Forward
0 new messages