84 lines
4.4 KiB
Python
84 lines
4.4 KiB
Python
import copy, datetime, hashlib, pytz, secrets
|
|
|
|
default_num_bytes = 8 # URL safe 8 bytes is 11 characters long and 16 bytes is 22 characters long
|
|
|
|
xxx_id_random_field_schema: dict = {
|
|
'title': 'XXX ID Random',
|
|
'description': 'This is an id_random field for this object.',
|
|
'min_length': 11,
|
|
'max_length': 22,
|
|
'example': secrets.token_urlsafe(8) # random each reloading of app with: secrets.token_urlsafe(8)
|
|
}
|
|
|
|
xxx_id_random_field_schema_default: dict = copy.copy(xxx_id_random_field_schema)
|
|
xxx_id_random_field_schema_default['default_factory'] = lambda:secrets.token_urlsafe(8)
|
|
|
|
created_updated_on_field_schema: dict = {
|
|
'title': 'Created or Updated On',
|
|
'description': 'This is the created or updated on timestamp field for this object. It is filled in by the SQL DB.',
|
|
'example': '2021-12-31T21:10:10'
|
|
}
|
|
|
|
base_fields = {}
|
|
#base_fields['id_random'] = xxx_id_random_field_schema_default
|
|
base_fields['obj_id_random'] = xxx_id_random_field_schema # General or generic object_id_random
|
|
base_fields['account_id_random'] = xxx_id_random_field_schema
|
|
base_fields['account_cfg_id_random'] = xxx_id_random_field_schema
|
|
base_fields['address_id_random'] = xxx_id_random_field_schema
|
|
base_fields['archive_id_random'] = xxx_id_random_field_schema
|
|
base_fields['contact_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_exhibit_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_file_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_abstract_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_badge_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_device_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_location_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_person_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_person_detail_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_presentation_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_presenter_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_registration_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_session_id_random'] = xxx_id_random_field_schema
|
|
base_fields['event_track_id_random'] = xxx_id_random_field_schema
|
|
base_fields['flask_cfg_id_random'] = xxx_id_random_field_schema
|
|
base_fields['fundraising_id_random'] = xxx_id_random_field_schema
|
|
base_fields['hosted_file_id_random'] = xxx_id_random_field_schema
|
|
base_fields['journal_id_random'] = xxx_id_random_field_schema
|
|
base_fields['journal_entry_id_random'] = xxx_id_random_field_schema
|
|
base_fields['membership_id_random'] = xxx_id_random_field_schema
|
|
base_fields['membership_profile_id_random'] = xxx_id_random_field_schema
|
|
base_fields['order_cart_id_random'] = xxx_id_random_field_schema
|
|
base_fields['order_cart_line_id_random'] = xxx_id_random_field_schema
|
|
base_fields['order_id_random'] = xxx_id_random_field_schema
|
|
base_fields['order_line_id_random'] = xxx_id_random_field_schema
|
|
base_fields['order_transaction_id_random'] = xxx_id_random_field_schema
|
|
base_fields['organization_id_random'] = xxx_id_random_field_schema
|
|
base_fields['page_id_random'] = xxx_id_random_field_schema
|
|
base_fields['person_id_random'] = xxx_id_random_field_schema
|
|
base_fields['post_id_random'] = xxx_id_random_field_schema
|
|
base_fields['post_comment_id_random'] = xxx_id_random_field_schema
|
|
base_fields['product_id_random'] = xxx_id_random_field_schema
|
|
base_fields['site_id_random'] = xxx_id_random_field_schema
|
|
base_fields['site_domain_id_random'] = xxx_id_random_field_schema
|
|
base_fields['user_id_random'] = xxx_id_random_field_schema
|
|
base_fields['user_role_id_random'] = xxx_id_random_field_schema
|
|
|
|
base_fields['created_on'] = created_updated_on_field_schema
|
|
base_fields['updated_on'] = created_updated_on_field_schema
|
|
|
|
base_fields['obj_type'] = {}
|
|
base_fields['obj_id_random'] = xxx_id_random_field_schema_default
|
|
base_fields['obj_id_rand'] = xxx_id_random_field_schema_default
|
|
base_fields['obj_id'] = {}
|
|
base_fields['obj_name'] = {}
|
|
base_fields['obj_notes'] = {}
|
|
|
|
base_fields['for_id_random'] = xxx_id_random_field_schema_default # NOTE: This field may need to be set = None in the actual models with this field.
|
|
|
|
#xxx_id_random_field_schema['alias'] = 'order_id_random'
|
|
#base_fields['id_random'] = xxx_id_random_field_schema_default
|
|
#xxx_id_random_field_schema['alias'] = 'user_id_random_x'
|
|
#c = {'alias': 'user_id_random_x'}
|
|
#base_fields['user_id_random'] = combine_dict(xxx_id_random_field_schema, c)
|