Skip to content

Commit

Permalink
Create choosing_wagtail_page_models_vs_django_models.md
Browse files Browse the repository at this point in the history
  • Loading branch information
williln authored Feb 26, 2024
1 parent 0945ab6 commit 29a65b9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions wagtail/choosing_wagtail_page_models_vs_django_models.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 29a65b9

Please sign in to comment.