Add member count to home

This commit is contained in:
Ludovic Stephan 2020-08-28 16:12:03 +02:00 committed by Martin Pépin
parent 8fa635773c
commit e7cc705350
No known key found for this signature in database
GPG key ID: E7520278B1774448
4 changed files with 64 additions and 19 deletions

View file

@ -0,0 +1,5 @@
from bds.models import BDSProfile
def member_count(request):
return {"member_count": BDSProfile.objects.filter(is_member=True).count()}

View file

@ -1,22 +1,55 @@
{% extends "bds/base.html" %} {% extends "bds/base.html" %}
{% load bulma_utils %}
{% block content %} {% block layout %}
<div class="container"> <div class="columns">
Bienvenue sur GestioBDS&#8239;! <div class="column is-2">
<section class="section">
<div class="box">
<div class="content has-text-centered">
<h1>{{ member_count }}</h1>
adhérent·e·s
</div>
</div>
</section>
</div>
<div class="column is-two-thirds">
<section class="section">
<br> {% if messages %}
<br> {% for message in messages %}
<div class="notification is-{{ message.level_tag|bulma_message_tag }}">
{% if 'safe' in message.tags %}
{{ message|safe }}
{% else %}
{{ message }}
{% endif %}
<button class="delete"></button>
</div>
{% endfor %}
{% endif %}
<div class="container">
Bienvenue sur GestioBDS&#8239;!
Le site est encore en développement. <br>
<br> <br>
Suivez notre avancement sur
<a href="https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/merge_requests?milestone_title=Int%C3%A9gration+du+BDS"> Le site est encore en développement.
cette milestone</a> sur le gitlab de l'ENS. <br>
<br> Suivez notre avancement sur
Faites vos remarques par mail à <a href="https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/merge_requests?milestone_title=Int%C3%A9gration+du+BDS">
<a href="mailto:klub-dev@ens.fr"><tt>klub-dev@ens.fr</tt></a> cette milestone</a> sur le gitlab de l'ENS.
ou en ouvrant une <br>
<a href="#https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/issues?milestone_title=Int%C3%A9gration+du+BDS"> Faites vos remarques par mail à
issue</a>. <a href="mailto:klub-dev@ens.fr"><tt>klub-dev@ens.fr</tt></a>
ou en ouvrant une
<a href="#https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/issues?milestone_title=Int%C3%A9gration+du+BDS">
issue</a>.
</div>
</section>
</div>
</div> </div>
{% endblock %} {% endblock layout %}

View file

@ -5,7 +5,7 @@ The settings that are not listed here are imported from .common
import os import os
from .common import * # NOQA from .common import * # NOQA
from .common import BASE_DIR, INSTALLED_APPS from .common import BASE_DIR, INSTALLED_APPS, TEMPLATES
# --- # ---
# BDS-only Django settings # BDS-only Django settings
@ -20,6 +20,10 @@ STATIC_URL = "/gestion2/static/"
MEDIA_ROOT = "/srv/bds.ens.fr/gestion2/media" MEDIA_ROOT = "/srv/bds.ens.fr/gestion2/media"
MEDIA_URL = "/gestion2/media/" MEDIA_URL = "/gestion2/media/"
TEMPLATES[0]["OPTIONS"]["context_processors"] += [
"bds.context_processors.member_count",
]
# --- # ---
# Auth-related stuff # Auth-related stuff

View file

@ -3,7 +3,7 @@ import os
from . import bds_prod from . import bds_prod
from .cof_prod import * # NOQA from .cof_prod import * # NOQA
from .cof_prod import BASE_DIR, INSTALLED_APPS, MIDDLEWARE, TESTING from .cof_prod import BASE_DIR, INSTALLED_APPS, MIDDLEWARE, TEMPLATES, TESTING
# --- # ---
# Merge COF and BDS configs # Merge COF and BDS configs
@ -13,6 +13,9 @@ for app in bds_prod.INSTALLED_APPS:
if app not in INSTALLED_APPS: if app not in INSTALLED_APPS:
INSTALLED_APPS.append(app) INSTALLED_APPS.append(app)
TEMPLATES[0]["OPTIONS"]["context_processors"] += [
"bds.context_processors.member_count",
]
# --- # ---
# Tweaks for debug/local development # Tweaks for debug/local development