Reputation: 1551
Is there a way I can assign a friendly name to a database column in Django? I'm looking for something like this:
class Person(models.Model):
first_name = models.CharField(max_length=100, friendly_name='First Name')
last_name = models.CharField(max_length=100, friendly_name='Last Name')
In order to access in a manner similar to this:
for f in Person._meta.get_fields():
print(f.friendly_name)
Output:
First Name
Last Name
I am using Django 2.1 and PostgreSQL 10.
Upvotes: 1
Views: 1178