update user model
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
from apps.authorization.api.v1.serializers import (
|
||||
UserRelationSerializer,
|
||||
PermissionSerializer,
|
||||
RoleSerializer
|
||||
)
|
||||
import typing
|
||||
|
||||
from django.contrib.auth.hashers import make_password
|
||||
from rest_framework import serializers
|
||||
|
||||
from apps.authentication.models import (
|
||||
User,
|
||||
City,
|
||||
@@ -14,8 +13,9 @@ from apps.authentication.models import (
|
||||
BankAccountInformation
|
||||
)
|
||||
from apps.authorization import models as authorize_models
|
||||
from django.contrib.auth.hashers import make_password
|
||||
import typing
|
||||
from apps.authorization.api.v1.serializers import (
|
||||
UserRelationSerializer
|
||||
)
|
||||
|
||||
|
||||
class CitySerializer(serializers.ModelSerializer):
|
||||
@@ -79,6 +79,8 @@ class UserSerializer(serializers.ModelSerializer):
|
||||
'nationality',
|
||||
'ownership',
|
||||
'address',
|
||||
'unit_name',
|
||||
'unit_national_id',
|
||||
'photo',
|
||||
'province',
|
||||
'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 (
|
||||
AbstractUser
|
||||
)
|
||||
from apps.core.models import BaseModel
|
||||
from django.db import models
|
||||
|
||||
from apps.core.models import BaseModel
|
||||
|
||||
|
||||
class User(AbstractUser, BaseModel):
|
||||
mobile = models.CharField(max_length=18, null=True)
|
||||
@@ -23,6 +23,8 @@ class User(AbstractUser, BaseModel):
|
||||
help_text="N is natural & L is legal"
|
||||
)
|
||||
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)
|
||||
province = models.ForeignKey(
|
||||
'Province',
|
||||
@@ -155,7 +157,7 @@ class OrganizationStats(BaseModel):
|
||||
|
||||
def __str__(self):
|
||||
return f'Organization: {self.organization.name}'
|
||||
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
return super(OrganizationStats, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user