Skip to content
Snippets Groups Projects

Přidáno upozornění v případě vytváření orga s duplicitním jménem.

Merged Jiří Kalvoda requested to merge jk/issue-118 into devel
1 file
+ 7
7
Compare changes
  • Side-by-side
  • Inline
+ 7
7
@@ -356,7 +356,7 @@ class UserEditForm(FlaskForm):
email = wtforms.StringField("E-mail", validators=[Required()])
note = wtforms.TextAreaField("Poznámka")
is_test = wtforms.BooleanField("Testovací účet")
allow_duplicity_name = wtforms.BooleanField("Přidat účet s duplicitním jménem")
allow_duplicate_name = wtforms.BooleanField("Přidat účet s duplicitním jménem")
submit = wtforms.SubmitField("Uložit")
def validate_email(form, field):
@@ -386,7 +386,7 @@ def org_user_edit(id: int):
raise werkzeug.exceptions.Forbidden()
form = UserEditForm(obj=user)
del form.allow_duplicity_name
del form.allow_duplicate_name
if (user.is_org or user.is_admin) and not g.user.is_admin:
# emaily u organizátorů může editovat jen správce
del form.email
@@ -435,7 +435,7 @@ def org_user_new():
form = UserEditForm()
form.submit.label.text = 'Vytvořit'
is_duplicit_name = False
is_duplicate_name = False
if form.validate_on_submit():
check = True
@@ -447,8 +447,8 @@ def org_user_new():
if (mo.db.get_session().query(db.User)
.filter_by(first_name=form.first_name.data, last_name=form.last_name.data, is_org=True)
.first() is not None):
is_duplicit_name = True
if not form.allow_duplicity_name.data:
is_duplicate_name = True
if not form.allow_duplicate_name.data:
flash('Organizátor s daným jménem již existuje. V případě, že se nejedná o chybu, zaškrtněte políčko ve formuláři.', 'danger')
check = False
@@ -482,6 +482,6 @@ def org_user_new():
return redirect(url_for('org_org', id=new_user.user_id))
return redirect(url_for('org_user', id=new_user.user_id))
if not is_duplicit_name:
del form.allow_duplicity_name
if not is_duplicate_name:
del form.allow_duplicate_name
return render_template('org_user_new.html', form=form, is_org=is_org)
Loading