Working on bug fix for columns that are empty in first rows.
This commit is contained in:
@@ -59,7 +59,7 @@ from app.models.e_stripe_models import *
|
||||
obj_type_kv_li = {
|
||||
'sponsorship': {
|
||||
'tbl': 'sponsorship', 'tbl_default': 'v_sponsorship', 'tbl_update': 'sponsorship',
|
||||
'mdl': Sponsorship_Base, 'mdl_default': Sponsorship_Base, 'mdl_in': None, 'mdl_out': None
|
||||
'mdl': Sponsorship_Base, 'mdl_default': Sponsorship_Base, 'mdl_in': Sponsorship_Base, 'mdl_out': Sponsorship_Base
|
||||
},
|
||||
'sponsorship_cfg': {
|
||||
'tbl': 'sponsorship_cfg', 'tbl_default': 'v_sponsorship_cfg', 'tbl_update': 'sponsorship_cfg',
|
||||
@@ -70,7 +70,7 @@ obj_type_kv_li = {
|
||||
'mdl': Event_Badge_Base, 'mdl_default': Event_Badge_Basic_Base, 'mdl_alt': Event_Badge_Basic_Base
|
||||
},
|
||||
'event_presenter': {
|
||||
'tbl': 'event_presenter', 'tbl_default': 'v_event_presenter', 'tbl_update': 'event_presenter', 'mdl': Event_Presenter_Base, 'mdl_default': Event_Presenter_Base,
|
||||
'tbl': 'event_presenter', 'tbl_default': 'v_event_presenter', 'tbl_update': 'event_presenter', 'mdl': Event_Presenter_Base, 'mdl_default': Event_Presenter_Base, 'mdl_in': Event_Presenter_Base, 'mdl_out': Event_Presenter_Out_Base
|
||||
},
|
||||
} # New 2024-04-23
|
||||
# obj_type_kv_li['example_template'] = {'tbl': 'example_template', 'tbl_default': 'v_example_template', 'tbl_update': 'example_template', 'mdl': Example_Template_Base, 'mdl_in': Example_Template_In_Base, 'mdl_out': Example_Template_Out_Base }
|
||||
|
||||
@@ -215,3 +215,185 @@ class Event_Presenter_Base(BaseModel):
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
# ### END ### API Event Presenter Models ### Event_Presenter_Base() ###
|
||||
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Presenter Models ### Event_Presenter_Base() ###
|
||||
class Event_Presenter_Out_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_presenter_id_random'],
|
||||
alias = 'event_presenter_id_random',
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_presenter_id'
|
||||
)
|
||||
|
||||
external_id: Optional[str] = Field(
|
||||
alias = 'event_presenter_external_id'
|
||||
)
|
||||
|
||||
code: Optional[str] = Field(
|
||||
# alias = 'event_presenter_code'
|
||||
)
|
||||
|
||||
event_id_random: Optional[str]
|
||||
event_id: Optional[int]
|
||||
|
||||
# event_abstract_id_random: Optional[str]
|
||||
# event_abstract_id: Optional[int]
|
||||
|
||||
# event_location_id_random: Optional[str]
|
||||
# event_location_id: Optional[int]
|
||||
|
||||
# event_person_id_random: Optional[str]
|
||||
# event_person_id: Optional[int]
|
||||
|
||||
event_presentation_id_random: Optional[str]
|
||||
event_presentation_id: Optional[int]
|
||||
|
||||
event_session_id_random: Optional[str]
|
||||
event_session_id: Optional[int]
|
||||
|
||||
# event_track_id_random: Optional[str]
|
||||
# event_track_id: Optional[int]
|
||||
|
||||
# for_type: Optional[str]
|
||||
# for_id: Optional[int]
|
||||
|
||||
pronouns: Optional[str] # Preferred pronouns
|
||||
informal_name: Optional[str] # Informal or nick name they commonly go by
|
||||
|
||||
title_names: Optional[str] # Title for generation, official position, or professional or academic qualification, other honorific, or other name prefix
|
||||
# prefix: Optional[str] # NOTE: Phasing out! Use *title_names* instead.
|
||||
given_name: Optional[str]
|
||||
middle_name: Optional[str]
|
||||
family_name: Optional[str]
|
||||
designations: Optional[str] # Temporary or long-term designations related to family, relationships, person differentiation (Junior/Senior), location, social status, professional qualifications, legal status, or other name suffix
|
||||
# suffix: Optional[str] # NOTE: Phasing out! Use *designations* instead.
|
||||
|
||||
professional_title: Optional[str] # Professional title
|
||||
# title: Optional[str] # NOTE: Phasing out! Use *professional_title* instead.
|
||||
|
||||
# display_name: Optional[str] # NOTE: This will be changed to full_name_override to match event_badge, event_person_profile, and person
|
||||
|
||||
# BEGIN # Auto created name variations
|
||||
full_name: Optional[str] # title_names given_name middle_name family_name designations
|
||||
full_name_override: Optional[str] # Override full_name; Actual name shown for presenter
|
||||
|
||||
# degree: Optional[str] # NOTE: Phasing out! Use *designations* instead.
|
||||
# degrees: Optional[str] # NOTE: Phasing out! Use *designations* instead.
|
||||
# credentials: Optional[str] # NOTE: Phasing out! Use *designations* instead.
|
||||
|
||||
affiliations: Optional[str] # One or more affiliations with organizations, companies, and other groups
|
||||
# affiliation: Optional[str] # NOTE: Phasing out! Use *affiliations* instead.
|
||||
|
||||
email: Optional[str]
|
||||
website_url: Optional[str]
|
||||
|
||||
# phone_li_json: Optional[Union[Json, None]]
|
||||
|
||||
# For social media in a JSON object format. The Aether standard field names should be used. Examples: url, url_text, icon, etc.
|
||||
social_li_json: Optional[Union[Json, None]]
|
||||
|
||||
tagline: Optional[str]
|
||||
biography: Optional[str]
|
||||
|
||||
# picture_path: Optional[str] # Start using image_li_json instead
|
||||
# picture_bg_color: Optional[str]
|
||||
|
||||
# For image files only in a JSON object format. The Aether standard field names should be used. Examples: url, url_text, alt_text, width, height, size (in bytes), etc.
|
||||
image_li_json: Optional[Union[Json, None]] # "headshot" is probably the most common
|
||||
# media_li_json: Optional[Union[Json, None]]
|
||||
|
||||
# role: Optional[str]
|
||||
|
||||
# file_count: Optional[int]
|
||||
|
||||
# General catchall for agreement or consent
|
||||
agree: Optional[bool]
|
||||
|
||||
# Comments from the presenter. This is for internal use only.
|
||||
comments: Optional[str]
|
||||
|
||||
enable: Optional[bool]
|
||||
# enable_from: Optional[datetime.datetime] = None
|
||||
# enable_to: Optional[datetime.datetime] = None
|
||||
|
||||
hide: Optional[bool]
|
||||
# public: Optional[bool]
|
||||
# public_hide: Optional[bool]
|
||||
# hide_event_launcher: Optional[bool]
|
||||
|
||||
priority: Optional[bool]
|
||||
sort: Optional[int] # The presenter number if given
|
||||
group: Optional[str]
|
||||
|
||||
notes: Optional[str]
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# Including convenience data
|
||||
# This is only for convenience. Probably going to keep unless it causes a problem.
|
||||
# event_name: Optional[str]
|
||||
# event_start_datetime: Optional[datetime.datetime]
|
||||
# event_end_datetime: Optional[datetime.datetime]
|
||||
# event_location_code: Optional[str]
|
||||
# event_location_name: Optional[str]
|
||||
# event_presentation_code: Optional[str]
|
||||
# event_presentation_type_code: Optional[str]
|
||||
# event_presentation_name: Optional[str]
|
||||
# event_presentation_start_datetime: Optional[datetime.datetime]
|
||||
# event_presentation_end_datetime: Optional[datetime.datetime]
|
||||
# event_session_code: Optional[str]
|
||||
# event_session_type_code: Optional[str]
|
||||
# event_session_name: Optional[str]
|
||||
# event_session_start_datetime: Optional[datetime.datetime]
|
||||
# event_session_end_datetime: Optional[datetime.datetime]
|
||||
|
||||
# Including other related objects
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
@validator('id', always=True)
|
||||
def event_presenter_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event_presenter')
|
||||
return None
|
||||
|
||||
@validator('event_id', always=True)
|
||||
def event_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('event_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event')
|
||||
return None
|
||||
|
||||
# @validator('event_person_id', always=True)
|
||||
# def event_person_id_lookup(cls, v, values, **kwargs):
|
||||
# if isinstance(v, int) and v > 0: return v
|
||||
# elif id_random := values.get('event_person_id_random'):
|
||||
# return redis_lookup_id_random(record_id_random=id_random, table_name='event_person')
|
||||
# return None
|
||||
|
||||
@validator('event_presentation_id', always=True)
|
||||
def event_presentation_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('event_presentation_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event_presentation')
|
||||
return None
|
||||
|
||||
@validator('event_session_id', always=True)
|
||||
def event_session_id_lookup(cls, v, values, **kwargs):
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('event_session_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='event_session')
|
||||
return None
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
# ### END ### API Event Presenter Models ### Event_Presenter_Base() ###
|
||||
|
||||
@@ -289,6 +289,7 @@ async def get_obj_li(
|
||||
# Loop through key value pairs in the dictionary
|
||||
log.info(f'Field value is a dict: {field_value}')
|
||||
for key, value in field_value.items():
|
||||
log.debug(f'Key: {key}')
|
||||
new_field_name = field_name[:-8]+'__'+key
|
||||
new_record[new_field_name] = value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user