aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-10-07 07:37:19 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-10-07 07:37:19 +0200
commit675c893271e4fa1c49a4abf45ced1bb580c03540 (patch)
treed1cbf6f8e261b4767cddf49d96a6b9eb50892bab
parentFetch feeds only if the user do not want to use its own crawler. (diff)
downloadnewspipe-675c893271e4fa1c49a4abf45ced1bb580c03540.tar.gz
newspipe-675c893271e4fa1c49a4abf45ced1bb580c03540.tar.bz2
newspipe-675c893271e4fa1c49a4abf45ced1bb580c03540.zip
An administrator is now able to set the value of 'auto_crawling' for a user.
-rw-r--r--src/web/forms.py2
-rw-r--r--src/web/templates/admin/create_user.html3
-rw-r--r--src/web/views/admin.py4
3 files changed, 8 insertions, 1 deletions
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 %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+ {{ form.automatic_crawling.label }}
+ {{ form.automatic_crawling(class_="form-control") }} {% for error in form.automatic_crawling.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+
<br />
{{ form.submit(class_="btn btn-default") }}
</form>
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',
bgstack15