aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/users
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-05-22 16:29:35 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-05-22 16:29:35 +0100
commit4d3eb4c4c7aff7d2837476cbc7ee524b3f5c2424 (patch)
tree2c9fe169e6500b361602fdf689789a71e448288e /ctrack/users
parent5d489ef3685b32ee5e9c68839b1e187870c0d659 (diff)
changed boolean field on user model
Diffstat (limited to 'ctrack/users')
-rw-r--r--ctrack/users/admin.py4
-rw-r--r--ctrack/users/migrations/0003_auto_20200522_1527.py18
-rw-r--r--ctrack/users/models.py2
-rw-r--r--ctrack/users/tests/factories.py2
-rw-r--r--ctrack/users/tests/test_models.py2
5 files changed, 24 insertions, 4 deletions
diff --git a/ctrack/users/admin.py b/ctrack/users/admin.py
index 120cc64..28e91eb 100644
--- a/ctrack/users/admin.py
+++ b/ctrack/users/admin.py
@@ -12,6 +12,8 @@ class UserAdmin(auth_admin.UserAdmin):
form = UserChangeForm
add_form = UserCreationForm
- fieldsets = (("User", {"fields": ("name",)}),) + auth_admin.UserAdmin.fieldsets
+ fieldsets = (
+ ("User", {"fields": ("name", "oes_user")}),
+ ) + auth_admin.UserAdmin.fieldsets
list_display = ["username", "name", "is_superuser"]
search_fields = ["name"]
diff --git a/ctrack/users/migrations/0003_auto_20200522_1527.py b/ctrack/users/migrations/0003_auto_20200522_1527.py
new file mode 100644
index 0000000..dc4f7c1
--- /dev/null
+++ b/ctrack/users/migrations/0003_auto_20200522_1527.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.5 on 2020-05-22 15:27
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('users', '0002_user_is_person'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='user',
+ old_name='is_person',
+ new_name='oes_user',
+ ),
+ ]
diff --git a/ctrack/users/models.py b/ctrack/users/models.py
index d1ab662..df23623 100644
--- a/ctrack/users/models.py
+++ b/ctrack/users/models.py
@@ -9,7 +9,7 @@ class User(AbstractUser):
# First Name and Last Name do not cover name patterns
# around the globe.
name = CharField(_("Name of User"), blank=True, max_length=255)
- is_person = BooleanField(default=False)
+ oes_user = BooleanField(default=False, verbose_name="OES User")
def get_absolute_url(self):
return reverse("users:detail", kwargs={"username": self.username})
diff --git a/ctrack/users/tests/factories.py b/ctrack/users/tests/factories.py
index eb5a17f..700d9b4 100644
--- a/ctrack/users/tests/factories.py
+++ b/ctrack/users/tests/factories.py
@@ -8,7 +8,7 @@ class UserFactory(DjangoModelFactory):
username = Faker("user_name")
email = Faker("email")
name = Faker("name")
- is_person = False
+ oes_user = False
@post_generation
def password(self, create: bool, extracted: Sequence[Any], **kwargs):
diff --git a/ctrack/users/tests/test_models.py b/ctrack/users/tests/test_models.py
index d83d8b8..54d337f 100644
--- a/ctrack/users/tests/test_models.py
+++ b/ctrack/users/tests/test_models.py
@@ -19,4 +19,4 @@ def test_user_get_absolute_url(user: User):
def test_user_is_person_object(user: User):
"""User comes from ctrack.conftest.
"""
- assert user.is_person is False
+ assert user.oes_user is False