From 29a65b99368755e89d60ff7d8ae6bcdabde5b70a Mon Sep 17 00:00:00 2001 From: Lacey Henschel Date: Mon, 26 Feb 2024 14:59:16 -0800 Subject: [PATCH] Create choosing_wagtail_page_models_vs_django_models.md --- ...ng_wagtail_page_models_vs_django_models.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 wagtail/choosing_wagtail_page_models_vs_django_models.md diff --git a/wagtail/choosing_wagtail_page_models_vs_django_models.md b/wagtail/choosing_wagtail_page_models_vs_django_models.md new file mode 100644 index 0000000..97757a1 --- /dev/null +++ b/wagtail/choosing_wagtail_page_models_vs_django_models.md @@ -0,0 +1,34 @@ +# Choosing Between Wagtail Page Models and Django Models + +> Generated by ChatGPT and edited by me. While I didn't write this, I did review it closely and it does reflect my experience. + +Discussion of the pros and cons to using a combination of Django models and Wagtail Page models in a Wagtail project, or only using Wagtail Page models for most objects. This was created in the context of an e-commerce platform. + +## Using Only Wagtail's Page Model + +### Pros +- **Integrated CMS Features**: Leverages Wagtail's built-in features like hierarchical structuring and rich text editing. +- **Simplicity**: Simplifies the architecture by avoiding additional models. +- **SEO and Navigation**: Benefits from Wagtail's SEO tools and site navigation integration. + +### Cons +- **Performance Issues**: The generic nature of the Page model may not be as efficient for a large catalog of products. +- **Limited Flexibility**: May find it challenging to manage complex relationships and queries with a more extensive product structure. + +## Integrating Custom Django Models + +### Pros +- **Performance and Scalability**: Custom models can be optimized for better performance with large datasets. +- **Flexibility**: Allows for a tailored database schema, making it easier to implement complex relationships and business logic. +- **Separation of Concerns**: Offers a cleaner, more modular architecture by separating e-commerce functionality from content management. + +### Cons +- **Increased Complexity**: Adds complexity to the application, requiring manual integration between Wagtail pages and Django models. +- **Integration Effort**: Some of Wagtail's out-of-the-box benefits need to be manually implemented for Django models. + +## Takeaway + +- **Simple Applications**: If the product catalog is modest and the product structure is straightforward, using Wagtail's Page model might suffice. +- **Complex Applications**: For platforms with a large number of products, complex attributes, or sophisticated business logic, integrating custom Django models with Wagtail pages is advisable for greater flexibility and performance. + +This decision should be based on the specific needs of the project, including the size of the product catalog, complexity of product data, and scalability requirements.