some changes
This commit is contained in:
2
.idea/Rasaddam_Backend.iml
generated
2
.idea/Rasaddam_Backend.iml
generated
@@ -14,7 +14,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="jdk" jdkName="Python 3.10 (bazrasienv)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.10 (env)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PyDocumentationSettings">
|
<component name="PyDocumentationSettings">
|
||||||
|
|||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (bazrasienv)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (env)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
||||||
@@ -16,7 +16,6 @@ def sync_role_permissions(sender, instance, **kwargs):
|
|||||||
permissions = instance.role.permissions.all()
|
permissions = instance.role.permissions.all()
|
||||||
if not instance.permissions.exists():
|
if not instance.permissions.exists():
|
||||||
instance.permissions.add(*permissions) # noqa
|
instance.permissions.add(*permissions) # noqa
|
||||||
print(instance.permissions)
|
|
||||||
|
|
||||||
instance._from_signal = True
|
instance._from_signal = True
|
||||||
instance.save()
|
instance.save()
|
||||||
|
|||||||
18
apps/herd/migrations/0011_rancher_herd_code.py
Normal file
18
apps/herd/migrations/0011_rancher_herd_code.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:25
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('herd', '0010_rancher_without_herd'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='rancher',
|
||||||
|
name='herd_code',
|
||||||
|
field=models.CharField(max_length=100, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:35
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('herd', '0011_rancher_herd_code'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='rancher',
|
||||||
|
name='national_code',
|
||||||
|
field=models.CharField(max_length=50, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='rancher',
|
||||||
|
name='nationality',
|
||||||
|
field=models.CharField(max_length=50, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:49
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('herd', '0012_alter_rancher_national_code_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='herd',
|
||||||
|
name='latitude',
|
||||||
|
field=models.DecimalField(decimal_places=6, max_digits=10, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='herd',
|
||||||
|
name='longitude',
|
||||||
|
field=models.DecimalField(decimal_places=6, max_digits=10, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:51
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('herd', '0013_alter_herd_latitude_alter_herd_longitude'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='herd',
|
||||||
|
name='latitude',
|
||||||
|
field=models.FloatField(default=0),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='herd',
|
||||||
|
name='longitude',
|
||||||
|
field=models.FloatField(default=0),
|
||||||
|
),
|
||||||
|
]
|
||||||
18
apps/herd/migrations/0015_alter_herd_postal.py
Normal file
18
apps/herd/migrations/0015_alter_herd_postal.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:55
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('herd', '0014_alter_herd_latitude_alter_herd_longitude'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='herd',
|
||||||
|
name='postal',
|
||||||
|
field=models.CharField(help_text='herd postal code', max_length=20, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -42,7 +42,7 @@ class Herd(BaseModel):
|
|||||||
null=True
|
null=True
|
||||||
)
|
)
|
||||||
postal = models.CharField(
|
postal = models.CharField(
|
||||||
max_length=10,
|
max_length=20,
|
||||||
help_text="herd postal code", null=True
|
help_text="herd postal code", null=True
|
||||||
)
|
)
|
||||||
institution = models.CharField(
|
institution = models.CharField(
|
||||||
@@ -56,8 +56,8 @@ class Herd(BaseModel):
|
|||||||
related_name="herd_contractor",
|
related_name="herd_contractor",
|
||||||
null=True
|
null=True
|
||||||
)
|
)
|
||||||
latitude = models.DecimalField(max_digits=22, decimal_places=16, null=True)
|
latitude = models.FloatField(default=0)
|
||||||
longitude = models.DecimalField(max_digits=22, decimal_places=16, null=True)
|
longitude = models.FloatField(default=0)
|
||||||
unit_unique_id = models.CharField(max_length=20, null=True)
|
unit_unique_id = models.CharField(max_length=20, null=True)
|
||||||
activity_types = (
|
activity_types = (
|
||||||
("I", "Industrial"),
|
("I", "Industrial"),
|
||||||
@@ -82,12 +82,13 @@ class Herd(BaseModel):
|
|||||||
|
|
||||||
class Rancher(BaseModel):
|
class Rancher(BaseModel):
|
||||||
ranching_farm = models.CharField(max_length=150, null=True)
|
ranching_farm = models.CharField(max_length=150, null=True)
|
||||||
|
herd_code = models.CharField(max_length=100, null=True)
|
||||||
first_name = models.CharField(max_length=150, null=True)
|
first_name = models.CharField(max_length=150, null=True)
|
||||||
last_name = models.CharField(max_length=150, null=True)
|
last_name = models.CharField(max_length=150, null=True)
|
||||||
mobile = models.CharField(max_length=25, null=True)
|
mobile = models.CharField(max_length=25, null=True)
|
||||||
national_code = models.CharField(max_length=20, null=True)
|
national_code = models.CharField(max_length=50, null=True)
|
||||||
birthdate = models.DateTimeField(null=True)
|
birthdate = models.DateTimeField(null=True)
|
||||||
nationality = models.CharField(max_length=20, null=True)
|
nationality = models.CharField(max_length=50, null=True)
|
||||||
address = models.TextField(blank=True)
|
address = models.TextField(blank=True)
|
||||||
province = models.ForeignKey(
|
province = models.ForeignKey(
|
||||||
auth_models.Province,
|
auth_models.Province,
|
||||||
|
|||||||
18
apps/livestock/migrations/0013_livestock_archive.py
Normal file
18
apps/livestock/migrations/0013_livestock_archive.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 08:31
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('livestock', '0012_livestocktype_weight_type'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='livestock',
|
||||||
|
name='archive',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -88,6 +88,7 @@ class LiveStock(BaseModel):
|
|||||||
(2, 'female')
|
(2, 'female')
|
||||||
)
|
)
|
||||||
gender = models.IntegerField(choices=gender_type, default=1)
|
gender = models.IntegerField(choices=gender_type, default=1)
|
||||||
|
archive = models.BooleanField(default=False)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.type.name}-{self.species.name}'
|
return f'{self.type.name}-{self.species.name}'
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:25
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pos_device', '0034_alter_deviceactivationcode_expires_at'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='deviceactivationcode',
|
||||||
|
name='expires_at',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2025, 8, 6, 10, 55, 42, 749910)),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:35
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pos_device', '0035_alter_deviceactivationcode_expires_at'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='deviceactivationcode',
|
||||||
|
name='expires_at',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2025, 8, 6, 11, 5, 16, 207384)),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:49
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pos_device', '0036_alter_deviceactivationcode_expires_at'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='deviceactivationcode',
|
||||||
|
name='expires_at',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2025, 8, 6, 11, 19, 3, 548332)),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:51
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pos_device', '0037_alter_deviceactivationcode_expires_at'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='deviceactivationcode',
|
||||||
|
name='expires_at',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2025, 8, 6, 11, 21, 14, 982190)),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 07:55
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pos_device', '0038_alter_deviceactivationcode_expires_at'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='deviceactivationcode',
|
||||||
|
name='expires_at',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2025, 8, 6, 11, 25, 53, 734145)),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-08-06 08:31
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pos_device', '0039_alter_deviceactivationcode_expires_at'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='deviceactivationcode',
|
||||||
|
name='expires_at',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2025, 8, 6, 12, 1, 26, 211551)),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -52,12 +52,13 @@ class DeviceViewSet(viewsets.ModelViewSet):
|
|||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
""" Custom create of pos devices """
|
""" Custom create of pos devices """
|
||||||
|
|
||||||
company = pos_models.ProviderCompany.objects.get(
|
if 'company' not in request.data.keys():
|
||||||
user_relation__user=request.user
|
company = pos_models.ProviderCompany.objects.get(
|
||||||
)
|
user_relation__user=request.user
|
||||||
|
)
|
||||||
|
request.data.update({'company': company.id})
|
||||||
|
|
||||||
# create device
|
# create device
|
||||||
request.data.update({'company': company.id})
|
|
||||||
serializer = self.serializer_class(data=request.data)
|
serializer = self.serializer_class(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
serializer.save()
|
serializer.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user