1

I am using Django1.6

i have abstract class A, and class B:

class A(Model):
    att = CharField()

    class Meta:
        abstract = True

class B(A):
    pass

i want to override the behaviour of 'att' (without touching class A): so when using:

b = B(att='a').save()
b.att  (output is 'a')

but i want to override the output: so:

b.att (output is something else like 'a_thanks')

class B(A):
    @propert
    def att(self):
        return self._att + '_thanks'

how can i do it? i know this is possible from django 1.10

Eyal Ch
  • 9,552
  • 5
  • 44
  • 54

0 Answers0