It's hard to say without the real ino, and not kowing why you want the info to be a field, I see no good reason you´d want a db field where all instances of a given model would share the same value.
But assuming you just want to set up a default, and be able to override it at will, you can always do: class Foo: def default_name(self): return 'Foo' name = CharField(default=default_name) Class Bar(Foo): def default_name(self): return "Bar" If you want it ACTUALLY to be theclass name, you don't even need to redefine it, you can just return self__class__,__name__ If you don´t want to be able change it in a per instance basis, then you´ re going about this the wrong way -----Mensaje original----- De: . Enviados: 04/08/2012 14:21:47 Asunto: Re: How to override an attribute? > https://docs.djangoproject.com/en/1.4/topics/db/models/#field-name-hiding-is-not-permitted I've already seen this link on stackoverflow. > Easiest solution to your underlying problem would likely be to find a > solution that does not require doing something Django does not support. Do you have an idea how to do the following without "doing something Django does not support"? 1. Each class should have the same attribute: a unique name. For example: class Foo(): ... class Bar(Foo): ... Foo.name should return "Foo" Bar.name should return "Bar" 2. name should be a field not just a string. (I want to store names in the database.) Cheers -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.