update user model
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
from apps.authorization.api.v1.serializers import (
|
import typing
|
||||||
UserRelationSerializer,
|
|
||||||
PermissionSerializer,
|
from django.contrib.auth.hashers import make_password
|
||||||
RoleSerializer
|
|
||||||
)
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from apps.authentication.models import (
|
from apps.authentication.models import (
|
||||||
User,
|
User,
|
||||||
City,
|
City,
|
||||||
@@ -14,8 +13,9 @@ from apps.authentication.models import (
|
|||||||
BankAccountInformation
|
BankAccountInformation
|
||||||
)
|
)
|
||||||
from apps.authorization import models as authorize_models
|
from apps.authorization import models as authorize_models
|
||||||
from django.contrib.auth.hashers import make_password
|
from apps.authorization.api.v1.serializers import (
|
||||||
import typing
|
UserRelationSerializer
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class CitySerializer(serializers.ModelSerializer):
|
class CitySerializer(serializers.ModelSerializer):
|
||||||
@@ -79,6 +79,8 @@ class UserSerializer(serializers.ModelSerializer):
|
|||||||
'nationality',
|
'nationality',
|
||||||
'ownership',
|
'ownership',
|
||||||
'address',
|
'address',
|
||||||
|
'unit_name',
|
||||||
|
'unit_national_id',
|
||||||
'photo',
|
'photo',
|
||||||
'province',
|
'province',
|
||||||
'city',
|
'city',
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-10-27 05:04
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('authentication', '0036_organization_phone'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='user',
|
||||||
|
name='unit_name',
|
||||||
|
field=models.CharField(max_length=150, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='user',
|
||||||
|
name='unit_national_id',
|
||||||
|
field=models.CharField(max_length=25, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
from django.contrib.auth.hashers import make_password
|
|
||||||
from django.contrib.auth.models import (
|
from django.contrib.auth.models import (
|
||||||
AbstractUser
|
AbstractUser
|
||||||
)
|
)
|
||||||
from apps.core.models import BaseModel
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
from apps.core.models import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class User(AbstractUser, BaseModel):
|
class User(AbstractUser, BaseModel):
|
||||||
mobile = models.CharField(max_length=18, null=True)
|
mobile = models.CharField(max_length=18, null=True)
|
||||||
@@ -23,6 +23,8 @@ class User(AbstractUser, BaseModel):
|
|||||||
help_text="N is natural & L is legal"
|
help_text="N is natural & L is legal"
|
||||||
)
|
)
|
||||||
address = models.TextField(max_length=1000, null=True)
|
address = models.TextField(max_length=1000, null=True)
|
||||||
|
unit_name = models.CharField(max_length=150, null=True)
|
||||||
|
unit_national_id = models.CharField(max_length=25, null=True)
|
||||||
photo = models.CharField(max_length=50, null=True)
|
photo = models.CharField(max_length=50, null=True)
|
||||||
province = models.ForeignKey(
|
province = models.ForeignKey(
|
||||||
'Province',
|
'Province',
|
||||||
@@ -155,7 +157,7 @@ class OrganizationStats(BaseModel):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'Organization: {self.organization.name}'
|
return f'Organization: {self.organization.name}'
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
return super(OrganizationStats, self).save(*args, **kwargs)
|
return super(OrganizationStats, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user