From 675c893271e4fa1c49a4abf45ced1bb580c03540 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Fri, 7 Oct 2016 07:37:19 +0200 Subject: An administrator is now able to set the value of 'auto_crawling' for a user. --- src/web/forms.py | 2 ++ src/web/templates/admin/create_user.html | 3 +++ src/web/views/admin.py | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/forms.py b/src/web/forms.py index 033ccbbe..d63394f7 100644 --- a/src/web/forms.py +++ b/src/web/forms.py @@ -133,6 +133,8 @@ class UserForm(Form): [validators.Length(min=6, max=35), validators.Required(lazy_gettext("Please enter your email."))]) password = PasswordField(lazy_gettext("Password")) + automatic_crawling = BooleanField(lazy_gettext("Automatic crawling"), + default=True) submit = SubmitField(lazy_gettext("Save")) def validate(self): diff --git a/src/web/templates/admin/create_user.html b/src/web/templates/admin/create_user.html index 1d6d6c11..5afa22b2 100644 --- a/src/web/templates/admin/create_user.html +++ b/src/web/templates/admin/create_user.html @@ -18,6 +18,9 @@ {{ form.password.label }} {{ form.password(class_="form-control") }} {% for error in form.password.errors %} {{ error }}
{% endfor %} + {{ form.automatic_crawling.label }} + {{ form.automatic_crawling(class_="form-control") }} {% for error in form.automatic_crawling.errors %} {{ error }}
{% endfor %} +
{{ form.submit(class_="btn btn-default") }} diff --git a/src/web/views/admin.py b/src/web/views/admin.py index 84e508a2..2ee46066 100644 --- a/src/web/views/admin.py +++ b/src/web/views/admin.py @@ -62,7 +62,8 @@ def process_user_form(user_id=None): user_contr.update({'id': user_id}, {'nickname': form.nickname.data, 'email': form.email.data, - 'password': form.password.data}) + 'password': form.password.data, + 'automatic_crawling': form.automatic_crawling.data}) user = user_contr.get(id=user_id) flash(gettext('User %(nick)s successfully updated', nick=user.nickname), 'success') @@ -71,6 +72,7 @@ def process_user_form(user_id=None): user = user_contr.create(nickname=form.nickname.data, email=form.email.data, pwdhash=generate_password_hash(form.password.data), + automatic_crawling=form.automatic_crawling.data, is_admin=False, is_active=True) flash(gettext('User %(nick)s successfully created', -- cgit