From 6efed4a9b754879108689d44df1238e361d4c394 Mon Sep 17 00:00:00 2001 From: Cory Zue Date: Tue, 3 Sep 2024 08:50:43 +0200 Subject: [PATCH 1/6] initial 2024.9 release notes --- release-notes.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/release-notes.md b/release-notes.md index 79fcbc6..ed5dc29 100644 --- a/release-notes.md +++ b/release-notes.md @@ -3,6 +3,20 @@ Version History and Release Notes Releases of [SaaS Pegasus: The Django SaaS Boilerplate](https://www.saaspegasus.com/) are documented here. +## Version 2024.9 + +### Added + +- Added `make manage` command to run arbitrary `manage.py` commands in a docker environment. + E.g. `make manage ARGS='createsuperuser'`. +- Added the ability to pass arguments to `make test` in docker. E.g. `make tests ARGS='apps.teams --keepdb'`. + (Thanks David for the suggestion!) + +### Changed + +- Changed links on the tailwind signup page to use `pg-link` class instead of explict tailwind classes. + (Thanks Peter for the suggestion!) + ## Version 2024.8.2 This is a maintenance release that includes a number of mostly small fixes and updates, From cdf8ca846396585216740d2543c427a5b075c1ff Mon Sep 17 00:00:00 2001 From: Cory Zue Date: Tue, 3 Sep 2024 08:50:54 +0200 Subject: [PATCH 2/6] add `make manage` to docs --- docker.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docker.md b/docker.md index f4cb251..eaeb45c 100644 --- a/docker.md +++ b/docker.md @@ -100,7 +100,13 @@ Or to promote a user to superuser, run: docker compose exec web python manage.py promote_user_to_superuser me@example.com ``` -Commonly used commands can be added to the `Makefile` for convenience. +You can also use the `make manage` command, passing in `ARGS` like so: + +``` +make manage ARGS='promote_user_to_superuser me@example.com' +``` + +You can add any commonly used commands you want to `custom.mk` for convenience. ## Updating Python packages From 7ce387ef5d1dc87e1654147472de424913803ad4 Mon Sep 17 00:00:00 2001 From: Cory Zue Date: Wed, 4 Sep 2024 16:01:17 +0200 Subject: [PATCH 3/6] add note --- release-notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release-notes.md b/release-notes.md index ed5dc29..6cb50d6 100644 --- a/release-notes.md +++ b/release-notes.md @@ -16,6 +16,8 @@ Releases of [SaaS Pegasus: The Django SaaS Boilerplate](https://www.saaspegasus. - Changed links on the tailwind signup page to use `pg-link` class instead of explict tailwind classes. (Thanks Peter for the suggestion!) +- Silenced extraneous djstripe warnings when running tests. (Thanks Chris for the suggestion!) + ## Version 2024.8.2 From af3ece4da266c11fa814e2dfddb422c6a3a81f16 Mon Sep 17 00:00:00 2001 From: Cory Zue Date: Mon, 9 Sep 2024 15:03:18 +0200 Subject: [PATCH 4/6] update release notes for ecommerce stuff --- release-notes.md | 284 ++++++++++++++++++++++++++++------------------- 1 file changed, 169 insertions(+), 115 deletions(-) diff --git a/release-notes.md b/release-notes.md index 6cb50d6..4d541df 100644 --- a/release-notes.md +++ b/release-notes.md @@ -5,6 +5,16 @@ Releases of [SaaS Pegasus: The Django SaaS Boilerplate](https://www.saaspegasus. ## Version 2024.9 +### E-Commerce / Payments demo improvmements + +- Added a `ProductConfiguration` model to attach additional metadata to products. +- E-Commerce product URLs and views now use the `ProductConfiguration` `slug` field instead of the Stripe Product IDs. +- Added a `@product_required` decorator that can be used to restrict access to views based on whether the user has purchased a product. +- Added a demo "access product" page that shows how to use the `@product_required` decorator. +- Added `user_owns_product` and `get_valid_user_purchase` helper functions. +- Improved the navigation and use of breadcrumbs in the demo UI. +- **See upgrade notes for information about migrating previous data to the new set up.** + ### Added - Added `make manage` command to run arbitrary `manage.py` commands in a docker environment. @@ -14,9 +24,53 @@ Releases of [SaaS Pegasus: The Django SaaS Boilerplate](https://www.saaspegasus. ### Changed -- Changed links on the tailwind signup page to use `pg-link` class instead of explict tailwind classes. +- Changed links on the tailwind signup page to use `pg-link` class instead of explict tailwind classes. (Thanks Peter for the suggestion!) - Silenced extraneous djstripe warnings when running tests. (Thanks Chris for the suggestion!) +- Added `.vscode` to `.gitignore`. +- Switched from `assert` statements to `raise ValueError` in the e-commerce Stripe checkout confirmation view. +- Moved some of the currency helper functions out of the `subscriptions` app into `utils.billing` so they can be + used in ecommerce workflows even if subscriptions are disabled. + + +### Fixed + +- Fixed a typo in the help text for the `bootstrap_ecommerce` command. + + +### Upgrade Notes + +If you have existing `Purchase` data in your application you will need to migrate it to the new `ProductConfiguration` structure. + +This is a three-step process: + +First you will need to apply the database updates, but allow `Purchase.product_configuration` to be null. +Instead of running `./manage.py migrate` you will have to run the following command: + +```bash +./manage.py migrate ecommerce 0002 +``` + +After running this, you can run the following command to migrate the existing data: + +```bash +./manage.py migrate_ecommerce +``` + +The `migrate_ecommerce` management command will: + +1. Create `ProductConfiguration` objects for all products in `settings.ACTIVE_ECOMMERCE_PRODUCT_IDS` +2. Create `ProductConfiguration` objects for all products referenced in existing `Purchase` models. +3. Set `purchase.product_configuration` to the new `ProductConfiguration` object for each `Purchase`. + +Finally, you can make the `Purchase.product_configuration` field non-null, by running: + +```bash +./manage.py migrate ecommerce 0003 +``` + +**New projects, or projects without any existing purchase data can skip these steps and run `./manage.py migrate` directly.** +However, you may still want to run `./manage.py migrate_ecommerce` to populate `ProductConfiguration` objects for your active products. ## Version 2024.8.2 @@ -46,7 +100,7 @@ and updates Django to version 5.1. ### Changed - **Upgraded Django to version 5.1.** -- Upgraded all Python packages to their latest versions. +- Upgraded all Python packages to their latest versions. - Updated Pegasus color CSS variables to use the DaisyUI variables, so that they change when you change DaisyUI themes. (Thanks Peter for the suggestion!) - Removed `custom.mk` if your project was not generated with a `Makefile`. (Thanks Finbar for reporting!) @@ -55,7 +109,7 @@ and updates Django to version 5.1. - Simplified Bulma navbar to use bulma native classes instead of custom CSS. (See upgrade note below.) - Updated default Github repo in `app-spec.yml` to use raw project slug instead of the hyphenated version. (Digital Ocean deployments, only, thanks Richard for suggesting) -- Moved `SERVER_EMAIL` and `DEFAULT_FROM_EMAIL` from `settings_production.py` to main `settings.py` file, +- Moved `SERVER_EMAIL` and `DEFAULT_FROM_EMAIL` from `settings_production.py` to main `settings.py` file, and made it possible to set them via the environment/`.env` file. - Added many more common settings and secrets to the Kamal `deploy.yml` file. @@ -90,13 +144,13 @@ This is a maintenance release which upgrades HTMX to version 2.0 and fixes a han - Switched the default celery pool to [solo](https://docs.celeryq.dev/en/stable/internals/reference/celery.concurrency.solo.html) in development, to fix issues running on Windows. See [updated docs](./celery.md). - Updated in-app help hint to recommend running `./manage.py bootstrap_ecommerce` instead of `./manage.py djstripe_sync_models price`. - + ### Upgrading Htmx 2.0 requires loading new extensions. If you were loading HTMX extensions in your own templates, you will have to upgrade the location of those to the 2.0 versions. -Before: +Before: ``` @@ -131,7 +185,7 @@ This is a maintenance release with many small updates and fixes. `ruff` and the pre-commit hooks are included in the project download. Projects that had already enabled auto-formatting are unaffected by this change. (See upgrade notes below.) - **The example landing pages are now used as the project's landing page instead of being listed in the examples**. - (Bulma and Tailwind builds only.) + (Bulma and Tailwind builds only.) - **Team invitation emails are now better styled, matching the same format as account emails.** (Thanks EJ for the suggestion!) - The `EMAIL_BACKEND` setting is now configurable via an environment variable. Also, added a commented-out example of how to set email settings for a production email provider (Mailgun). @@ -180,7 +234,7 @@ To fix this, remove the social application from either your settings or the data This is hotfix release that addresses a few issues from yesterday's update: -- Fix app styles accidentally being purged during the Docker build process. +- Fix app styles accidentally being purged during the Docker build process. This caused styling on Docker-based deployments for tailwind builds. (Thanks Steve for reporting!) - Moved channels url import to after Django initialization. This fixes an `AppRegistryNotReady` error when deploying asynchronous apps with the AI chat app enabled. @@ -255,7 +309,7 @@ Below is the complete set of changes in this release. - Fixed a bug where team names longer than 50 characters could cause a crash during sign up. - Fixed a bug where multi-factor authentication QR codes had a dark background when dark mode was enabled (Tailwind builds only). (Thanks Artem for reporting!) -- Fixed a bug where it was possible to bypass two-factor-authentication when using the API authentication views. +- Fixed a bug where it was possible to bypass two-factor-authentication when using the API authentication views. (Thanks Finbar for reporting and helping with the fix!) - Fixed a bug where deleting the user's only team while impersonating them resulted in a temporary crash. (Thanks EJ for reporting!) @@ -279,7 +333,7 @@ Below is the complete set of changes in this release. - **Changed the formatter/linter from `black` and `isort` to [ruff](https://github.com/astral-sh/ruff).** See above. - Also addressed a handful of minor linting errors that came up as a result of this change. - Codebase linting is now substantially faster. - - Unused imports are now automatically removed when building your projects. + - Unused imports are now automatically removed when building your projects. - **Celerybeat now uses the `django-celery-beat` library to store tasks in the database instead of on the filesystem.** This improves support for celerybeat on Docker-based platforms. (Thanks Peter and Artem for the suggestion!) - Also added a migration to save the default scheduled tasks in the database. @@ -290,7 +344,7 @@ Below is the complete set of changes in this release. - Changed behavior when team role checks fail from raising a `TeamPermissionError` to returning a 403 response, and updated affected tests. One side effect of this is that the stack traces are removed from successful test runs. - Secret keys should no longer change every time you build your Pegasus project. - They are also now clearly prefixed with `django-insecure-` to indicate that they should be changed in production. + They are also now clearly prefixed with `django-insecure-` to indicate that they should be changed in production. - Updated the default OpenAI chat model to gpt-4o. - Upgraded the openapi client generator to version 7.5.0 and also pinned the version used by `make build-api-client` to the same one. @@ -342,7 +396,7 @@ in Docker. Thanks Mohamed for reporting this! - Fix `api-client` path in the frontend docker container and add to `optimizeDeps` in vite config. - Mount `node_modules` as an anonymous volume in the frontend docker container, so it is not overwritten. -- Automatically create `./frontend/.env` when running `make init` if it doesn't exist. +- Automatically create `./frontend/.env` when running `make init` if it doesn't exist. *May 14, 2024* @@ -396,13 +450,13 @@ The complete release notes are below: - **The AI image generation now supports Dall-E 3 and Stability AI.** - **All generated projects now include a `LICENSE.md` file.** The goal of the license file is not to change how Pegasus can be used in any way, but rather to document those - terms in the codebase itself (previously they were only documented on the [terms page](https://www.saaspegasus.com/terms/)). + terms in the codebase itself (previously they were only documented on the [terms page](https://www.saaspegasus.com/terms/)). For more information you can see the new [license page](https://www.saaspegasus.com/license/). - **Added support for "magic-code login", where a user can login to the site by requesting a code to their email address.** [Documentation.](./configuration.md#enabling-sign-in-by-email-code) - **Google cloud run builds now support Redis.** For details, see the [updated documentation](./deployment/google-cloud.md). (Thanks Forrest for suggesting!) -- Added a `custom.mk` file where you can add additional `make` targets without worrying about future Pegasus upgrades. +- Added a `custom.mk` file where you can add additional `make` targets without worrying about future Pegasus upgrades. (Thanks John for proposing this!) ### Changed @@ -433,7 +487,7 @@ The complete release notes are below: - **SQLite build now properly parse `DATABASE_URL` if it is set. This fixes issues deploying to certain platforms when building with SQLite.** (Thanks Manasvini for reporting!) - Updated allauth documentation links in the README to point to the new [allauth docs site](https://docs.allauth.org/). - (Thanks Shantu for reporting!) + (Thanks Shantu for reporting!) ### Removed @@ -445,7 +499,7 @@ The complete release notes are below: - Removed the no-longer-used `openai_example` app (functionality has been moved to `apps.chat` and `apps.ai_images`). - Removed the no-longer-needed `AccountAdapter` class. This class was previously used to add two-factor support to login, which is now handled natively by allauth. - + ### Upgrading **Two-factor authentication** @@ -464,7 +518,7 @@ compromising their security.** The change of adding the `defer` keyword to `