From 5d220e360454e7643eb5539fa329702cb5c273c5 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 9 Apr 2014 20:14:33 +0200 Subject: Management of users via the administrator's account. --- pyaggr3g470r/templates/admin/create_user.html | 29 +++++++ pyaggr3g470r/templates/admin/dashboard.html | 44 ++++++++++ pyaggr3g470r/templates/admin/user.html | 49 +++++++++++ pyaggr3g470r/templates/home.html | 2 +- pyaggr3g470r/templates/layout.html | 3 + pyaggr3g470r/views.py | 120 +++++++++++++++++++++++++- 6 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 pyaggr3g470r/templates/admin/create_user.html create mode 100644 pyaggr3g470r/templates/admin/dashboard.html create mode 100644 pyaggr3g470r/templates/admin/user.html (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/templates/admin/create_user.html b/pyaggr3g470r/templates/admin/create_user.html new file mode 100644 index 00000000..5a6838bd --- /dev/null +++ b/pyaggr3g470r/templates/admin/create_user.html @@ -0,0 +1,29 @@ +{% extends "layout.html" %} +{% block head%} +{{super()}} +{% endblock %} +{% block content %} +
+
+

{{ message|safe }}

+
+ {{ form.hidden_tag() }} + + {{ form.firstname.label }} + {{ form.firstname(class_="form-control") }} {% for error in form.firstname.errors %} {{ error }}
{% endfor %} + + {{ form.lastname.label }} + {{ form.lastname(class_="form-control") }} {% for error in form.lastname.errors %} {{ error }}
{% endfor %} + + {{ form.email.label }} + {{ form.email(class_="form-control") }} {% for error in form.email.errors %} {{ error }}
{% endfor %} + + {{ form.password.label }} + {{ form.password(class_="form-control") }} {% for error in form.password.errors %} {{ error }}
{% endfor %} + +
+ {{ form.submit(class_="btn") }} +
+
+
+{% endblock %} \ No newline at end of file diff --git a/pyaggr3g470r/templates/admin/dashboard.html b/pyaggr3g470r/templates/admin/dashboard.html new file mode 100644 index 00000000..2913d603 --- /dev/null +++ b/pyaggr3g470r/templates/admin/dashboard.html @@ -0,0 +1,44 @@ +{% extends "layout.html" %} +{% block head%} +{{super()}} +{% endblock %} +{% block content %} +
+

Registered users

+ + + + + + + + + + + + {% for user in users|sort(attribute="firstname") %} + + + + + + + + {% endfor %} + +
#FirstnameLastnameEmailActions
{{ loop.index }}{{ user.firstname }}{{ user.lastname }}{{ user.email }} + + + {% if user.apikey == "" %} + + {% else %} + + {% endif %} + +
+
+Add a new user +

+

As an administrator you are not listed in this table.

+
+{% endblock %} \ No newline at end of file diff --git a/pyaggr3g470r/templates/admin/user.html b/pyaggr3g470r/templates/admin/user.html new file mode 100644 index 00000000..767ff460 --- /dev/null +++ b/pyaggr3g470r/templates/admin/user.html @@ -0,0 +1,49 @@ +{% extends "layout.html" %} +{% block head%} +{{super()}} +{% endblock %} +{% block content %} +
+
+ Edit this user +

Membership

+

Contributor since {{ user.date_created.strftime('%A, %d %B %Y') }}.

+

Last seen: {{ user.last_seen.strftime('%A, %d %B %Y at %H:%M:%S') }}.

+
+
+ {% if user.feeds.all()|count == 0 %} +

This user is not subscribed to any feed.

+ {% else %} +

Feeds

+ + + + + + + + + + + + + {% for feed in user.feeds|sort(attribute="name") %} + + + + + + + + {% endfor %} + +
#NameFeed linkSite linkNumber of articlesActions
{{ loop.index }}{{ feed.title }}{{ feed.link }}{{ feed.site_link }}{{ feed.articles.all()|count }} + + + +
+ {% endif %} + Add a new feed +
+
+{% endblock %} \ No newline at end of file diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html index 223653c1..6363ee06 100644 --- a/pyaggr3g470r/templates/home.html +++ b/pyaggr3g470r/templates/home.html @@ -2,7 +2,7 @@ {% block content %}
{% if user.feeds.all()|count == 0 %} -

You are not subscribed to any feed. Fix this.

+

You are not subscribed to any feed. Fix this.

{% else %} {% for feed in user.feeds|sort(attribute="title") %}
diff --git a/pyaggr3g470r/templates/layout.html b/pyaggr3g470r/templates/layout.html index e89706e9..71572181 100644 --- a/pyaggr3g470r/templates/layout.html +++ b/pyaggr3g470r/templates/layout.html @@ -56,6 +56,9 @@
  • Management
  • + {% if g.user.is_admin() %} +
  • Dashboard
  • + {% endif %}
  • About
  • Logout