Scenario 1 doesn't make sense. You're using the constants to specify the verbose_name
of the fields, and you're using them in the list_display
option. The list_display
option takes a list of fieldnames and NOT the verbose_name
of the fields.
So you don't need constants at all for this. The field names are your "constants".
And IF you would need some "constants" in some case, you shouldn't use methods, just use properties, and just use normal class/attribute name conventions (so no uppercases):
class SomeConstants():
name = "name"
surname = "surname"
zipcode = "zipcode"
city = "city"
created = "created"
The Java/PHP guys might say something like "Yeah but what if one of the constants needs to be generated? Then you need a method!". Well, sure, so you make it a property:
class SomeConstants():
@property
def full_name(self):
return "{} {}".format(self.name, self.surname)
Because of the @property
line above the method, it will execute and return the result of this method if you call SomeConstants().full_name
.