- Add a default make to the tenant
- Add a make to the SpecialistMagicLink
This commit is contained in:
@@ -691,9 +691,13 @@ def specialist_magic_link():
|
||||
try:
|
||||
new_specialist_magic_link = SpecialistMagicLink()
|
||||
|
||||
# Populate fields individually instead of using populate_obj (gives problem with QueryMultipleSelectField)
|
||||
# Populate fields individually instead of using populate_obj
|
||||
form.populate_obj(new_specialist_magic_link)
|
||||
|
||||
# Handle the tenant_make_id special case (0 = None)
|
||||
if form.tenant_make_id.data == 0:
|
||||
new_specialist_magic_link.tenant_make_id = None
|
||||
|
||||
set_logging_information(new_specialist_magic_link, dt.now(tz.utc))
|
||||
|
||||
# Create 'public' SpecialistMagicLinkTenant
|
||||
@@ -733,12 +737,23 @@ def edit_specialist_magic_link(specialist_magic_link_id):
|
||||
|
||||
form.add_dynamic_fields("arguments", specialist_config, specialist_ml.specialist_args)
|
||||
|
||||
# Set the tenant_make_id default value
|
||||
if request.method == 'GET':
|
||||
if specialist_ml.tenant_make_id is None:
|
||||
form.tenant_make_id.data = 0
|
||||
else:
|
||||
form.tenant_make_id.data = specialist_ml.tenant_make_id
|
||||
|
||||
if form.validate_on_submit():
|
||||
# Update the basic fields
|
||||
form.populate_obj(specialist_ml)
|
||||
# Update the arguments dynamic fields
|
||||
specialist_ml.specialist_args = form.get_dynamic_data("arguments")
|
||||
|
||||
# Handle the tenant_make_id special case (0 = None)
|
||||
if form.tenant_make_id.data == 0:
|
||||
specialist_ml.tenant_make_id = None
|
||||
|
||||
# Update logging information
|
||||
update_logging_information(specialist_ml, dt.now(tz.utc))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user