add 2 new fields city & province in device - fix bug of filter_by_region
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0 on 2025-10-27 10:38
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentication', '0039_remove_organizationtype_region_scope'),
|
||||
('pos_device', '0075_posfreeproducts_company_fee'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='device',
|
||||
name='city',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='devices', to='authentication.city'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='device',
|
||||
name='province',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='devices', to='authentication.province'),
|
||||
),
|
||||
]
|
||||
@@ -1,12 +1,14 @@
|
||||
from apps.product.models import Product, Broker, QuotaBrokerValue, QuotaDistribution
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from apps.authorization.models import UserRelations
|
||||
from apps.authentication.models import Organization
|
||||
from apps.core.models import BaseModel
|
||||
from django.db import models
|
||||
import random
|
||||
import string
|
||||
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from django.db import models
|
||||
|
||||
from apps.authentication.models import Organization, City, Province
|
||||
from apps.authorization.models import UserRelations
|
||||
from apps.core.models import BaseModel
|
||||
from apps.product.models import Product, Broker, QuotaBrokerValue, QuotaDistribution
|
||||
|
||||
|
||||
class ProviderCompany(BaseModel):
|
||||
user_relation = models.ForeignKey(
|
||||
@@ -40,6 +42,18 @@ class Device(BaseModel):
|
||||
server_in = models.BooleanField(default=False)
|
||||
latitude = models.FloatField(default=0)
|
||||
longitude = models.FloatField(default=0)
|
||||
city = models.ForeignKey(
|
||||
City,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='devices',
|
||||
null=True
|
||||
)
|
||||
province = models.ForeignKey(
|
||||
Province,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='devices',
|
||||
null=True
|
||||
)
|
||||
is_activated = models.BooleanField(default=False)
|
||||
pre_registered = models.BooleanField(default=False)
|
||||
organization = models.ForeignKey(
|
||||
|
||||
Reference in New Issue
Block a user