From 7498677bbd6590dd9131be20c9dfb87681e150bc Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sat, 27 Apr 2024 09:00:23 +0200 Subject: [PATCH] Permissions are strings, not integers Signed-off-by: Emmy D'Anello --- chat/migrations/0001_initial.py | 8 +++++--- chat/models.py | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/chat/migrations/0001_initial.py b/chat/migrations/0001_initial.py index 75f8f15..294bd7e 100644 --- a/chat/migrations/0001_initial.py +++ b/chat/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.0.3 on 2024-04-27 06:48 +# Generated by Django 5.0.3 on 2024-04-27 07:00 import django.db.models.deletion from django.conf import settings @@ -30,7 +30,7 @@ class Migration(migrations.Migration): ("name", models.CharField(max_length=255, verbose_name="name")), ( "read_access", - models.PositiveSmallIntegerField( + models.CharField( choices=[ ("anonymous", "Everyone, including anonymous users"), ("authenticated", "Authenticated users"), @@ -53,12 +53,13 @@ class Migration(migrations.Migration): ), ("admin", "Admin users"), ], + max_length=16, verbose_name="read permission", ), ), ( "write_access", - models.PositiveSmallIntegerField( + models.CharField( choices=[ ("anonymous", "Everyone, including anonymous users"), ("authenticated", "Authenticated users"), @@ -81,6 +82,7 @@ class Migration(migrations.Migration): ), ("admin", "Admin users"), ], + max_length=16, verbose_name="write permission", ), ), diff --git a/chat/models.py b/chat/models.py index b5a35e7..66e0f93 100644 --- a/chat/models.py +++ b/chat/models.py @@ -13,12 +13,14 @@ class Channel(models.Model): verbose_name=_("name"), ) - read_access = models.PositiveSmallIntegerField( + read_access = models.CharField( + max_length=16, verbose_name=_("read permission"), choices=PermissionType, ) - write_access = models.PositiveSmallIntegerField( + write_access = models.CharField( + max_length=16, verbose_name=_("write permission"), choices=PermissionType, )