Django models: when should I use the @property decorator for attributes?

I would like to know what the best practice will be. I used the @property decorator a lot because it allows me to avoid creating custom context variables when I want to display something related to the model instance in the template.

I feel my models are too big. This is normal?

+6
source share
1 answer

This is not a problem if you do not draw the exact same code on the model after the model. At this point, you should consider creating a template tag that the model takes instead.

+4
source

Source: https://habr.com/ru/post/913673/


All Articles