fix cuser_role model and add unique together

This commit is contained in:
javad committed 2024-01-23 10:54:48 +03:30
1 parent 4e7fa3d6ef
commit 5052bde49a
5 files changed
+60 -2

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@
<component name="ChangeListManager">
<list default="true" id="87c5db51-3e89-4a98-9bbb-121c9c52ab3c" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/utils/get_user_workspace.py" beforeDir="false" afterPath="$PROJECT_DIR$/utils/get_user_workspace.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/apps/cuser/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/apps/cuser/models.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -91,7 +91,7 @@
<workItem from="1697269439761" duration="66295000" />
<workItem from="1702900258020" duration="63755000" />
<workItem from="1704088148329" duration="105568000" />
<workItem from="1704951046597" duration="82372000" />
<workItem from="1704951046597" duration="82861000" />
</task>
<servers />
</component>
@@ -0,0 +1,18 @@
# Generated by Django 4.2.1 on 2024-01-23 07:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('workspace', '0013_alter_workspace_cuser_owner'),
('cuser', '0009_cuserrole_cuser'),
]
operations = [
migrations.AlterUniqueTogether(
name='cuserrole',
unique_together={('cuser', 'role_type', 'sys_ws')},
),
]
+3
View File
@@ -30,6 +30,9 @@ class CuserRole(BaseModel):
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
is_active = models.BooleanField(default=False)
class Meta:
unique_together = ('cuser', 'role_type', 'sys_ws', )
def __str__(self):
return f'{str(self.cuser) } - { str(self.id) }'
@@ -0,0 +1,19 @@
# Generated by Django 4.2.1 on 2024-01-23 07:21
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('jwt_auth', '0072_alter_cuserroleloginopt_uuid'),
]
operations = [
migrations.AlterField(
model_name='cuserroleloginopt',
name='uuid',
field=models.UUIDField(default=uuid.UUID('d65744d0-d235-4b75-a7b1-4349ae36d7d2'), unique=True),
),
]
@@ -0,0 +1,18 @@
# Generated by Django 4.2.1 on 2024-01-23 07:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reminder', '0022_alter_reminder_type'),
]
operations = [
migrations.AlterField(
model_name='reminder',
name='type',
field=models.CharField(choices=[('CU', 'CUSTOMER'), ('LE', 'LEAD'), ('UN', 'UNKNOWN'), ('NO', 'NOTE')], default='UN', max_length=2),
),
]