Working on clean up of some code... logging and pydantic field config.
This commit is contained in:
@@ -5,7 +5,6 @@ from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
|
||||
from ..lib_general import *
|
||||
from ..log import *
|
||||
|
||||
from .common_field_schema import base_fields, default_num_bytes
|
||||
#from .account_model import Account_Base
|
||||
@@ -15,10 +14,8 @@ class Address_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
#from .account_model import Account_Base
|
||||
|
||||
id_random: str = Field(
|
||||
#**base_fields['address_id_random'],
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['address_id_random'],
|
||||
alias='address_id_random',
|
||||
default_factory=lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
@@ -29,7 +26,7 @@ class Address_Base(BaseModel):
|
||||
account_id: Optional[int]
|
||||
|
||||
for_type: Optional[str]
|
||||
for_id_random: Optional[str] = None
|
||||
for_id_random: Optional[str]
|
||||
for_id: Optional[int]
|
||||
|
||||
#organization: Optional[Organization_Base] = Organization_Base()
|
||||
@@ -117,6 +114,6 @@ class Address_Base(BaseModel):
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
#fields = base_fields
|
||||
fields = base_fields
|
||||
|
||||
Address_Base.update_forward_refs()
|
||||
#Address_Base.update_forward_refs()
|
||||
|
||||
Reference in New Issue
Block a user