{"version":"1.0","type":"rich","title":"Gist d9bd6e033807a916fd0e","description":"This example contrasts before and after versions of a Django page type definition, showing how class-based refactoring organizes the same portfolio rendering logic. The before.py file uses standalone functions with module-level attributes, while after.py wraps these into a `GalleryPageType` class inheriting from `cms.PageType`. Both versions use Django’s `TemplateResponse` to render a `portfolio_item.html` template, query `PortfolioItem` and its related `photos` via the ORM, and filter active items. The code demonstrates how class inheritance consolidates metadata like `unique`, `required`, and `cachable` while preserving identical request handling and context updates.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-d9bd6e033807a916fd0e?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}