How to change field attributes or models of a third-party Django application?

Let's say I use django.contrib.flatpages or any other third-party application in my project. I want to change some of these attributes of the application model - for example, verbose_name. How can i do this?

+4
source share
2 answers

The simple answer is โ€œno needโ€; use a proxy model instead.

+6
source

It depends. If you want to add some new fields, you can create another model with OneToOneField . If you want to add some methods, orders, etc., Use a proxy model. If you want to change some database restrictions (for example, max_length ), you can fix the application source code, but think twice before doing this, you must have a really good reason.

If you want to change verbose_name , you can redefine the label in the corresponding field of the form, no changes to the model are required.

+3
source

All Articles