add & fix stakr holeders default

This commit is contained in:
2025-09-14 12:22:34 +03:30
parent 9b523ff1bd
commit d45a74f8cd
3 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2025-09-14 08:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pos_device', '0073_device_mac'),
]
operations = [
migrations.AddField(
model_name='stakeholders',
name='default',
field=models.BooleanField(default=False),
),
]

View File

@@ -272,6 +272,7 @@ class StakeHolders(BaseModel):
related_name='pos_stake_holders',
null=True
)
default = models.BooleanField(default=False)
def __str__(self):
return f'Device: {self.assignment.device.serial}-organization: {self.organization.name}'

View File

@@ -238,6 +238,7 @@ class DeviceAssignmentViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
assignment=assignment,
device=assignment.device,
organization=assignment.client.organization,
default=True
)
return Response(serializer.data, status=status.HTTP_201_CREATED)