forked from DGNum/gestioCOF
Remove context processor
This commit is contained in:
parent
e7cc705350
commit
d3384dc5fc
4 changed files with 8 additions and 17 deletions
|
@ -1,5 +0,0 @@
|
||||||
from bds.models import BDSProfile
|
|
||||||
|
|
||||||
|
|
||||||
def member_count(request):
|
|
||||||
return {"member_count": BDSProfile.objects.filter(is_member=True).count()}
|
|
|
@ -8,6 +8,7 @@ from django.views.generic import DeleteView, TemplateView
|
||||||
from bds.autocomplete import bds_search
|
from bds.autocomplete import bds_search
|
||||||
from bds.forms import ProfileForm, UserForm, UserFromClipperForm, UserFromScratchForm
|
from bds.forms import ProfileForm, UserForm, UserFromClipperForm, UserFromScratchForm
|
||||||
from bds.mixins import MultipleFormView, StaffRequiredMixin
|
from bds.mixins import MultipleFormView, StaffRequiredMixin
|
||||||
|
from bds.models import BDSProfile
|
||||||
from shared.views import AutocompleteView
|
from shared.views import AutocompleteView
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
@ -21,6 +22,11 @@ class BDSAutocompleteView(StaffRequiredMixin, AutocompleteView):
|
||||||
class Home(StaffRequiredMixin, TemplateView):
|
class Home(StaffRequiredMixin, TemplateView):
|
||||||
template_name = "bds/home.html"
|
template_name = "bds/home.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context["member_count"] = BDSProfile.objects.filter(is_member=True).count()
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class UserUpdateView(StaffRequiredMixin, MultipleFormView):
|
class UserUpdateView(StaffRequiredMixin, MultipleFormView):
|
||||||
template_name = "bds/user_update.html"
|
template_name = "bds/user_update.html"
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
Django development settings for the cof project.
|
Django development settings for the cof project.
|
||||||
The settings that are not listed here are imported from .common
|
The settings that are not listed here are imported from .common
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
|
|
||||||
from .common import * # NOQA
|
from .common import * # NOQA
|
||||||
from .common import BASE_DIR, INSTALLED_APPS, TEMPLATES
|
from .common import INSTALLED_APPS
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# BDS-only Django settings
|
# BDS-only Django settings
|
||||||
|
@ -20,10 +18,6 @@ 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
|
||||||
|
|
|
@ -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, TEMPLATES, TESTING
|
from .cof_prod import BASE_DIR, INSTALLED_APPS, MIDDLEWARE, TESTING
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Merge COF and BDS configs
|
# Merge COF and BDS configs
|
||||||
|
@ -13,10 +13,6 @@ 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
|
||||||
# ---
|
# ---
|
||||||
|
|
Loading…
Reference in a new issue