before change Ticket Desc to TextArea
This commit is contained in:
1 parent
f7dbd02a6c
commit
ef18434b86
55 files changed
+1026
-59
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.1 on 2024-02-10 09:59
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lead', '0035_alter_lead_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lead',
|
||||
name='status',
|
||||
field=models.CharField(blank=True, choices=[('SU', 'OK'), ('UN', 'unknown'), ('FA', 'FAIL')], default='UN', max_length=2, null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.1 on 2024-02-10 11:06
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lead', '0036_alter_lead_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lead',
|
||||
name='status',
|
||||
field=models.CharField(blank=True, choices=[('UN', 'unknown'), ('SU', 'OK'), ('FA', 'FAIL')], default='UN', max_length=2, null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.1 on 2024-02-18 09:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lead', '0037_alter_lead_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lead',
|
||||
name='status',
|
||||
field=models.CharField(blank=True, choices=[('FA', 'FAIL'), ('SU', 'OK'), ('UN', 'unknown')], default='UN', max_length=2, null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.1 on 2024-02-27 09:59
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lead', '0038_alter_lead_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lead',
|
||||
name='status',
|
||||
field=models.CharField(blank=True, choices=[('SU', 'OK'), ('UN', 'unknown'), ('FA', 'FAIL')], default='UN', max_length=2, null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.1 on 2024-04-16 06:28
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lead', '0039_alter_lead_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='lead',
|
||||
name='status',
|
||||
field=models.CharField(blank=True, choices=[('FA', 'FAIL'), ('SU', 'OK'), ('UN', 'unknown')], default='UN', max_length=2, null=True),
|
||||
),
|
||||
]
|
||||
+21
-3
@@ -3,7 +3,7 @@ from apps.lead.models import Lead as LeadModel, LeadType as LeadTypeModel,\
|
||||
from apps.shop.models import ProductType as ProductTypeModel
|
||||
from apps.workspace.models import City as CityModel
|
||||
from utils.get_user_workspace import get_user_workspace_uuid
|
||||
from utils.get_cuser_role import get_cuser_role_uuid
|
||||
from utils.get_cuser_role import get_cuser_role_uuid, get_cuser_role
|
||||
from rest_framework import exceptions
|
||||
|
||||
|
||||
@@ -12,7 +12,16 @@ def list_leads(request) -> LeadModel:
|
||||
try:
|
||||
workspace_uuid = get_user_workspace_uuid(request)
|
||||
cuser_role_uuid = get_cuser_role_uuid(request)
|
||||
leads = LeadModel.objects.filter(sys_ws__uuid=workspace_uuid, cuser_role__uuid=cuser_role_uuid).order_by('-created_at')
|
||||
cuser_role = get_cuser_role(request)
|
||||
|
||||
base_filter = {
|
||||
'sys_ws__uuid': workspace_uuid,
|
||||
}
|
||||
|
||||
if not cuser_role.is_admin:
|
||||
base_filter['cuser_role__uuid'] = cuser_role_uuid
|
||||
|
||||
leads = LeadModel.objects.filter(**base_filter).order_by('-created_at')
|
||||
|
||||
return leads
|
||||
except Exception as exp:
|
||||
@@ -25,7 +34,16 @@ def retrieve_lead(request, id: int) -> LeadModel:
|
||||
try:
|
||||
workspace_uuid = get_user_workspace_uuid(request)
|
||||
cuser_role_uuid = get_cuser_role_uuid(request)
|
||||
lead = LeadModel.objects.get(id=id, sys_ws__uuid=workspace_uuid, cuser_role__uuid=cuser_role_uuid)
|
||||
|
||||
cuser_role = get_cuser_role(request)
|
||||
base_filter = {
|
||||
'sys_ws__uuid': workspace_uuid,
|
||||
}
|
||||
|
||||
if not cuser_role.is_admin:
|
||||
base_filter['cuser_role__uuid'] = cuser_role_uuid
|
||||
|
||||
lead = LeadModel.objects.get(id=id, **base_filter)
|
||||
return lead
|
||||
except Exception as exp:
|
||||
message = f'Error retrieve Leads: {exp}'
|
||||
|
||||
@@ -139,6 +139,11 @@ class LeadListApi(ListAPIView):
|
||||
'ostan': inline_serializer(many=False, fields={'name': serializers.CharField() })
|
||||
})
|
||||
|
||||
cuser_role = inline_serializer(many=False, fields={
|
||||
'id': serializers.IntegerField(),
|
||||
'name_family': serializers.CharField()
|
||||
})
|
||||
|
||||
class Meta:
|
||||
model = LeadModel
|
||||
fields = '__all__'
|
||||
|
||||
Reference in new issue
Block a user