Modeling custom behavior without touching the database While proxy models aren't the most critical feature in the Django framework, they do seem to get short shrift. Here's a look into how to use this feature to create new and clean interfaces to data without making changes to your database. Django’s proxy models are one of those features that I remember reading about and thinking, “oh, cool… I guess” and then moving along. From time to time, they do come in very handy, but there’s not that much written about how to best make use of them What are they? A proxy model is just another class that provides a different interface for the same underlying database model. That’s it. Really. A proxy model is a subclass of a database-table defining model. Typically creating a subclass of a model results in a new database table with a reference back to the original model’s table - multi-table inheritance. A proxy model doesn’t get its own database table. Instead it operates on...
Hi, I’m Deepak Dubey. The founder of this blog. I’m a Full-stack Python Developer | OpenedX professional and part-time blogger. I’m here to write the blogs related to technology stuff like Python, Django , Open-edX, Data Science, machine Learning and many more.