forked from mirrors/bookwyrm
Adds field for user deactivation reason
This commit is contained in:
parent
8f3601d4cd
commit
93fe091034
2 changed files with 31 additions and 0 deletions
18
bookwyrm/migrations/0066_user_deactivation_reason.py
Normal file
18
bookwyrm/migrations/0066_user_deactivation_reason.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.1.8 on 2021-04-12 15:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bookwyrm', '0065_merge_20210411_1702'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='deactivation_reason',
|
||||
field=models.CharField(blank=True, choices=[('self_deletion', 'Self Deletion'), ('moderator_deletion', 'Moderator Deletion'), ('domain_block', 'Domain Block')], max_length=255, null=True),
|
||||
),
|
||||
]
|
|
@ -24,6 +24,16 @@ from .federated_server import FederatedServer
|
|||
from . import fields, Review
|
||||
|
||||
|
||||
DeactivationReason = models.TextChoices(
|
||||
"DeactivationReason",
|
||||
[
|
||||
"self_deletion",
|
||||
"moderator_deletion",
|
||||
"domain_block",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
class User(OrderedCollectionPageMixin, AbstractUser):
|
||||
""" a user who wants to read books """
|
||||
|
||||
|
@ -111,6 +121,9 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
|||
default=str(pytz.utc),
|
||||
max_length=255,
|
||||
)
|
||||
deactivation_reason = models.CharField(
|
||||
max_length=255, choices=DeactivationReason.choices, null=True, blank=True
|
||||
)
|
||||
|
||||
name_field = "username"
|
||||
property_fields = [("following_link", "following")]
|
||||
|
|
Loading…
Reference in a new issue