-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/upgrade emails for plans (#80)
* create automatically groups for User Plans in impresso.apps.ImpressoConfig (apps.py) * Create UserChangePlanRequest model and related migrations * Update admin.py to get the new model UserChangePlanRequest * add email templates per group and user role * add test, typings and doc to email methods, also including send_email_password_reset * upgrade patch version django * Add specific task to add an user to a group in tasks.py * Create post_save signal to ship celery task in externa module signals.py * fix user request plan admin layout * add missing templates for accepted and rejected emails * add documentation on UserRequest model * delegate group addition to celery task to prevent LOCK mysql error
- Loading branch information
1 parent
630d68e
commit 6a39fb0
Showing
29 changed files
with
1,291 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ImpressoConfig(AppConfig): | ||
name = "impresso" | ||
verbose_name = "Impresso" | ||
|
||
def ready(self): | ||
# we import the signal handler inside the ready() method to avoid import issues | ||
from django.db.models.signals import post_migrate, post_save, m2m_changed | ||
from impresso.models import UserBitmap | ||
from django.contrib.auth.models import User | ||
from .signals import ( | ||
create_default_groups, | ||
post_save_user_change_plan_request, | ||
) | ||
|
||
post_migrate.connect(create_default_groups, sender="impresso") | ||
|
||
post_save.connect( | ||
post_save_user_change_plan_request, | ||
sender="impresso.UserChangePlanRequest", | ||
) |
50 changes: 50 additions & 0 deletions
50
impresso/migrations/0051_userrequestingchangeplan_userchangeplanrequest.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Generated by Django 5.1.4 on 2024-12-19 11:12 | ||
|
||
import django.contrib.auth.models | ||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('auth', '0012_alter_user_first_name_max_length'), | ||
('impresso', '0050_alter_job_type'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='UserRequestingChangePlan', | ||
fields=[ | ||
], | ||
options={ | ||
'proxy': True, | ||
'indexes': [], | ||
'constraints': [], | ||
}, | ||
bases=('auth.user',), | ||
managers=[ | ||
('objects', django.contrib.auth.models.UserManager()), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='UserChangePlanRequest', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('date_created', models.DateTimeField(auto_now_add=True)), | ||
('date_last_modified', models.DateTimeField(auto_now=True)), | ||
('status', models.CharField(choices=[('pending', 'Pending'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='pending', max_length=10)), | ||
('changelog', models.JSONField(blank=True, default=list, null=True)), | ||
('notes', models.TextField(blank=True, null=True)), | ||
('plan', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='auth.group')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='changePlanRequest', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'verbose_name': 'User Change Plan Request', | ||
'verbose_name_plural': 'User Change Plan Requests', | ||
'unique_together': {('user', 'plan')}, | ||
}, | ||
), | ||
] |
16 changes: 16 additions & 0 deletions
16
impresso/migrations/0052_delete_userrequestingchangeplan.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Generated by Django 5.1.4 on 2024-12-19 12:29 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('impresso', '0051_userrequestingchangeplan_userchangeplanrequest'), | ||
] | ||
|
||
operations = [ | ||
migrations.DeleteModel( | ||
name='UserRequestingChangePlan', | ||
), | ||
] |
21 changes: 21 additions & 0 deletions
21
impresso/migrations/0053_alter_userchangeplanrequest_user.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 5.1.4 on 2024-12-20 16:02 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('impresso', '0052_delete_userrequestingchangeplan'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='userchangeplanrequest', | ||
name='user', | ||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='changePlanRequest', to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
impresso/migrations/0054_alter_userchangeplanrequest_unique_together.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 5.1.4 on 2024-12-20 16:04 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('impresso', '0053_alter_userchangeplanrequest_user'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterUniqueTogether( | ||
name='userchangeplanrequest', | ||
unique_together=set(), | ||
), | ||
] |
This file contains 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
Oops, something went wrong.