Minor badge clean up

This commit is contained in:
Scott Idem
2022-07-06 12:06:07 -04:00
parent 511f420555
commit 0a41699f5b
2 changed files with 15 additions and 0 deletions

View File

@@ -175,6 +175,13 @@ class Event_Badge_Base(BaseModel):
return redis_lookup_id_random(record_id_random=id_random, table_name='event')
return None
@validator('event_id_only', always=True)
def event_id_only_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v
elif id_random := values.get('event_id_random_only'):
return redis_lookup_id_random(record_id_random=id_random, table_name='event')
return None
@validator('event_badge_template_id', always=True)
def event_badge_template_id_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v