From e59bd893fd726e181ae90a7522a497b3f6080222 Mon Sep 17 00:00:00 2001 From: Nate Smith Date: Mon, 15 Jul 2019 21:10:35 -0500 Subject: [PATCH] actually remove reviewed field plus required migrations --- .../migrations/0013_auto_20190716_0148.py | 25 +++++++++++++++++++ .../migrations/0014_auto_20190716_0151.py | 23 +++++++++++++++++ .../migrations/0015_remove_townie_reviewed.py | 19 ++++++++++++++ ttadmin/users/models.py | 1 - 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 ttadmin/users/migrations/0013_auto_20190716_0148.py create mode 100644 ttadmin/users/migrations/0014_auto_20190716_0151.py create mode 100644 ttadmin/users/migrations/0015_remove_townie_reviewed.py diff --git a/ttadmin/users/migrations/0013_auto_20190716_0148.py b/ttadmin/users/migrations/0013_auto_20190716_0148.py new file mode 100644 index 0000000..77b7a75 --- /dev/null +++ b/ttadmin/users/migrations/0013_auto_20190716_0148.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.2 on 2019-07-16 01:48 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0012_auto_20190710_1622'), + ] + + operations = [ + migrations.AddField( + model_name='townie', + name='state', + field=models.CharField(choices=[('3_rejected', 'Rejected'), ('2_accepted', 'Accepted'), ('0_unreviewed', 'Unreviewed'), ('4_permaban', 'Permanently Banned'), ('1_tempban', 'Temporarily Banned')], default='0_unreviewed', max_length=20), + ), + migrations.AlterField( + model_name='townie', + name='notes', + field=models.TextField(blank=True, help_text='Use this field to share information about this user (reviewed or not) for other admins to see', null=True), + ), + ] diff --git a/ttadmin/users/migrations/0014_auto_20190716_0151.py b/ttadmin/users/migrations/0014_auto_20190716_0151.py new file mode 100644 index 0000000..5aa9775 --- /dev/null +++ b/ttadmin/users/migrations/0014_auto_20190716_0151.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.2 on 2019-07-16 01:51 +from __future__ import unicode_literals + +from django.db import migrations + +def set_state(apps, _): + Townie = apps.get_model('users', 'Townie') + for townie in Townie.objects.all(): + if townie.reviewed: + townie.state = Townie.ACCEPTED + + townie.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0013_auto_20190716_0148'), + ] + + operations = [ + migrations.RunPython(set_state) + ] diff --git a/ttadmin/users/migrations/0015_remove_townie_reviewed.py b/ttadmin/users/migrations/0015_remove_townie_reviewed.py new file mode 100644 index 0000000..73ee79a --- /dev/null +++ b/ttadmin/users/migrations/0015_remove_townie_reviewed.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.2 on 2019-07-16 02:10 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0014_auto_20190716_0151'), + ] + + operations = [ + migrations.RemoveField( + model_name='townie', + name='reviewed', + ), + ] diff --git a/ttadmin/users/models.py b/ttadmin/users/models.py index 82b1ad7..392e2d2 100644 --- a/ttadmin/users/models.py +++ b/ttadmin/users/models.py @@ -58,7 +58,6 @@ class Townie(User): ) shell = CharField(max_length=50, default="/bin/bash") state = CharField(max_length=20, choices=STATE_CHOICES, default=UNREVIEWED) - reviewed = BooleanField(default=False) reasons = TextField(blank=True, null=False, default='') plans = TextField(blank=True, null=False, default='') socials = TextField(blank=True, null=False, default='')