-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert user expert status, add auto create user profile (#463)
* Revert user expert status, add auto create user profile * revert settings.
- Loading branch information
Showing
4 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...isass_authentication/migrations/0009_alter_userprofile_expert_approval_status_and_more.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,35 @@ | ||
# Generated by Django 4.2.7 on 2023-12-18 05:40 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def change_user_profile(apps, schema_editor): | ||
UserProfile = apps.get_model('minisass_authentication', 'UserProfile') | ||
for user_profile in UserProfile.objects.all(): | ||
user_profile.expert_approval_status = 'REJECTED' | ||
if user_profile.expert_approval_status == 'APPROVED' and user_profile.certificate: | ||
user_profile.is_expert = True | ||
else: | ||
user_profile.is_expert = False | ||
user_profile.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('minisass_authentication', '0008_userprofile_expert_approval_status'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='userprofile', | ||
name='expert_approval_status', | ||
field=models.CharField(choices=[('PENDING', 'PENDING'), ('APPROVED', 'APPROVED'), ('REJECTED', 'REJECTED')], default='REJECTED'), | ||
), | ||
migrations.AlterField( | ||
model_name='userprofile', | ||
name='is_password_enforced', | ||
field=models.BooleanField(default=True, help_text='Flag whether user has been enforced to use strong password'), | ||
), | ||
migrations.RunPython(change_user_profile, lambda a, b: None) | ||
] |
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