diff --git a/fedireads/forms.py b/fedireads/forms.py index 0dd5f4d6..34a7802b 100644 --- a/fedireads/forms.py +++ b/fedireads/forms.py @@ -51,7 +51,7 @@ class CommentForm(ModelForm): class EditUserForm(ModelForm): class Meta: model = models.User - fields = ['avatar', 'name', 'summary'] + fields = ['avatar', 'name', 'summary', 'manually_approves_followers'] help_texts = {f: None for f in fields} diff --git a/fedireads/migrations/0013_user_manually_approves_followers.py b/fedireads/migrations/0013_user_manually_approves_followers.py new file mode 100644 index 00000000..c94aaed9 --- /dev/null +++ b/fedireads/migrations/0013_user_manually_approves_followers.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.3 on 2020-03-09 20:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fedireads', '0012_auto_20200308_1625'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='manually_approves_followers', + field=models.BooleanField(default=False), + ), + ] diff --git a/fedireads/models/user.py b/fedireads/models/user.py index 292a7906..23df60be 100644 --- a/fedireads/models/user.py +++ b/fedireads/models/user.py @@ -50,6 +50,7 @@ class User(AbstractUser): ) created_date = models.DateTimeField(auto_now_add=True) updated_date = models.DateTimeField(auto_now=True) + manually_approves_followers = models.BooleanField(default=False) @property def absolute_id(self): diff --git a/fedireads/view_actions.py b/fedireads/view_actions.py index eb8e5f47..5aa2c8ad 100644 --- a/fedireads/view_actions.py +++ b/fedireads/view_actions.py @@ -23,6 +23,7 @@ def edit_profile(request): if 'avatar' in form.files: request.user.avatar = form.files['avatar'] request.user.summary = form.data['summary'] + request.user.manually_approves_followers = form.cleaned_data['manually_approves_followers'] request.user.save() return redirect('/user/%s' % request.user.localname)