- Create framework for chat-client, including logo, explanatory text, color settings, ...
- remove allowed_langages from tenant - Correct bugs in Tenant, TenantMake, SpecialistMagicLink - Change chat client customisation elements
This commit is contained in:
@@ -177,13 +177,17 @@ class EditTenantProjectForm(FlaskForm):
|
||||
|
||||
|
||||
def validate_make_name(form, field):
|
||||
# Controleer of een TenantMake met deze naam al bestaat
|
||||
# Check if tenant_make already exists in the database
|
||||
existing_make = TenantMake.query.filter_by(name=field.data).first()
|
||||
|
||||
# Als er een bestaande make is gevonden en we zijn niet in edit mode,
|
||||
# of als we wel in edit mode zijn maar het is een ander record (andere id)
|
||||
if existing_make and (not hasattr(form, 'id') or form.id.data != existing_make.id):
|
||||
raise ValidationError(f'A Make with name "{field.data}" already exists. Choose another name.')
|
||||
if existing_make:
|
||||
current_app.logger.debug(f'Existing make: {existing_make.id}')
|
||||
current_app.logger.debug(f'Form has id: {hasattr(form, 'id')}')
|
||||
if hasattr(form, 'id'):
|
||||
current_app.logger.debug(f'Form has id: {form.id.data}')
|
||||
if existing_make:
|
||||
if not hasattr(form, 'id') or form.id.data != existing_make.id:
|
||||
raise ValidationError(f'A Make with name "{field.data}" already exists. Choose another name.')
|
||||
|
||||
|
||||
class TenantMakeForm(DynamicFormBase):
|
||||
|
||||
Reference in New Issue
Block a user