Repository navigation
Added domain_id to facilitate wba find_template etc. - #1
Open
thijs-creemers wants to merge 9 commits into
Open
thijs-creemers wants to merge 9 commits into
thijs-creemers wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds multi-tenant support to the mail_editor package by introducing a domain_id field to the MailTemplate model. This allows different domains/sites to have their own versions of mail templates while sharing the same codebase.
Key Changes:
- Added
domain_idfield toMailTemplatemodel with database migration - Extended
find_template()helper andMailTemplateManagermethods to support domain filtering - Updated validation logic and admin interface to handle domain-based template uniqueness
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| mail_editor/models.py | Added domain_id field, updated manager methods (get_for_language, get_for_domain), and enhanced uniqueness validation to include domain_id |
| mail_editor/helpers.py | Updated find_template() to accept and handle domain_id parameter with fallback to default setting |
| mail_editor/settings.py | Added DEFAULT_DOMAIN_ID setting property (defaults to 1) |
| mail_editor/admin.py | Added domain_id to list_display, list_filter, and fieldsets for admin interface |
| mail_editor/migrations/0014_mailtemplate_domain_id.py | Database migration to add domain_id field with default value of 1 |
| mail_editor/management/commands/add_missing_templates.py | Added --domain-id command-line argument to specify domain when creating templates |
| tests/test_domain_id.py | Comprehensive test suite covering domain_id functionality including creation, retrieval, uniqueness validation, and filtering |
| CHANGELOG.md | Documents new features, migration details, and breaking changes for version 0.4.0 |
Comments suppressed due to low confidence (1)
tests/test_domain_id.py:111
- Variable template_default is not used.
template_default = find_template("test_template", domain_id=3)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Update test_admin.py to use new validation error message - Add comprehensive DOMAIN_ID_IMPLEMENTATION.md documentation - Error message now includes 'domain' to reflect uniqueness constraint
- Update django dependency from '>=3.2' to '>=3.2,<6.0' - This prevents tox from installing Django 6.0 when testing with Django 3.2 - Supports Django 3.2, 4.2, and 5.x versions
- Add default='' to language field to prevent migration issues - Add default='' to base_template_path field to prevent migration issues - Create migration 0015 to alter these fields - Fixes issue where null=True was removed but no default was provided
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Explain what changes inside the code, this can be as simple or complicated as you want as long as it's clear
Why
Explain why these things are changes. This explanation is for your colleagues and your future self.
Code Review
Please consider the following checklist when reviewing this Pull Request.
More background and details here.