From 6ad7659ae57a97ce053310b07ac5de8356c89deb Mon Sep 17 00:00:00 2001 From: yasondinalt Date: Mon, 14 Mar 2016 20:19:57 +0200 Subject: [PATCH 1/5] signals: user_signed_up with request and new updated_account signal --- account/signals.py | 3 ++- account/views.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/account/signals.py b/account/signals.py index 307c8cea..d4a56bd1 100644 --- a/account/signals.py +++ b/account/signals.py @@ -3,7 +3,7 @@ import django.dispatch -user_signed_up = django.dispatch.Signal(providing_args=["user", "form"]) +user_signed_up = django.dispatch.Signal(providing_args=["user", "form", "request"]) user_sign_up_attempt = django.dispatch.Signal(providing_args=["username", "email", "result"]) user_logged_in = django.dispatch.Signal(providing_args=["user", "form"]) user_login_attempt = django.dispatch.Signal(providing_args=["username", "result"]) @@ -12,3 +12,4 @@ email_confirmed = django.dispatch.Signal(providing_args=["email_address"]) email_confirmation_sent = django.dispatch.Signal(providing_args=["confirmation"]) password_changed = django.dispatch.Signal(providing_args=["user"]) +updated_account = django.dispatch.Signal(providing_args=["user", "request"]) diff --git a/account/views.py b/account/views.py index 6c7189cd..4a2a8886 100644 --- a/account/views.py +++ b/account/views.py @@ -212,7 +212,7 @@ def send_email_confirmation(self, email_address): email_address.send_confirmation(site=get_current_site(self.request)) def after_signup(self, form): - signals.user_signed_up.send(sender=SignupForm, user=self.created_user, form=form) + signals.user_signed_up.send(sender=SignupForm, user=self.created_user, form=form, request=self.request) def login_user(self): user = self.created_user @@ -713,6 +713,10 @@ def form_valid(self, form): def update_settings(self, form): self.update_email(form) self.update_account(form) + self.after_update_account() + + def after_update_account(self): + signals.updated_account.send(sender=SettingsView, user=self.request.user, request=self.request) def update_email(self, form, confirm=None): user = self.request.user From 73fd10ded69d2e58863564e8030d3425e926ecc5 Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 9 Jan 2024 02:39:04 -0800 Subject: [PATCH 2/5] Rename updated_account signal to account_updated --- account/signals.py | 2 +- account/views.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/account/signals.py b/account/signals.py index d4a56bd1..d0e49387 100644 --- a/account/signals.py +++ b/account/signals.py @@ -12,4 +12,4 @@ email_confirmed = django.dispatch.Signal(providing_args=["email_address"]) email_confirmation_sent = django.dispatch.Signal(providing_args=["confirmation"]) password_changed = django.dispatch.Signal(providing_args=["user"]) -updated_account = django.dispatch.Signal(providing_args=["user", "request"]) +account_updated = django.dispatch.Signal(providing_args=["user", "request"]) diff --git a/account/views.py b/account/views.py index 4a2a8886..ed70d22e 100644 --- a/account/views.py +++ b/account/views.py @@ -714,9 +714,9 @@ def update_settings(self, form): self.update_email(form) self.update_account(form) self.after_update_account() - + def after_update_account(self): - signals.updated_account.send(sender=SettingsView, user=self.request.user, request=self.request) + signals.account_updated.send(sender=SettingsView, user=self.request.user, request=self.request) def update_email(self, form, confirm=None): user = self.request.user From 3ddb9f1cdd69ca8d8f061e94b40d043abd3114ef Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 9 Jan 2024 02:39:46 -0800 Subject: [PATCH 3/5] Document changes to user_signed_up signal and new account_updated signal --- docs/signals.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/signals.rst b/docs/signals.rst index 57d1f7b0..8b5ea2c0 100644 --- a/docs/signals.rst +++ b/docs/signals.rst @@ -8,7 +8,7 @@ user_signed_up -------------- Triggered when a user signs up successfully. Providing arguments ``user`` -(User instance) and ``form`` (form instance) as arguments. +(User instance), ``form`` (form instance), and ``request`` as arguments. user_sign_up_attempt @@ -66,4 +66,11 @@ password_changed ---------------- Triggered when a user changes his password. Providing argument ``user`` -(User instance). \ No newline at end of file +(User instance). + + +account_updated +--------------- + +Triggered when a user updates their account. Provided ``user`` and ``request`` +as arguments. From be7bcec9422ac5777fb73baeb1026aa4378cef06 Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 9 Jan 2024 02:56:21 -0800 Subject: [PATCH 4/5] Fix ruff linting --- .github/workflows/ci.yaml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0cc1bb37..529e696b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,14 +13,12 @@ jobs: with: python-version: "3.11" - - name: Install lint dependencies - run: | - python -m pip install --upgrade pip - pip install ruff - - name: Lint with ruff - run: | - ruff --format=github --target-version=py311 account + uses: chartboost/ruff-action@v1 + with: + src: "./account" + version: 0.1.11 + args: --target-version=py311 test: name: Testing From 571fd6d566e879575579370b39981139d53f8197 Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 9 Jan 2024 02:57:30 -0800 Subject: [PATCH 5/5] Add Python 3.12 and Django 5.0 to CI matrix --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 529e696b..7dcd37ca 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,12 +30,18 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" django: - "3.2.*" - "4.2.*" + - "5.0.*" exclude: - python: "3.11" django: "3.2.*" + - python: "3.8" + django: "5.0.*" + - python: "3.9" + django: "5.0.*" steps: - uses: actions/checkout@v2