Django app providing Django framework theme for Django-based web apps, themed for CEDA Services. Requires lower-level fwtheme-django.
fwtheme-django-ceda-serv
can be installed directly from Github using pip:
$ pip install git+https://github.com/cedadev/fwtheme-django-ceda-serv.git
In settings.py
, this app should have an entry in INSTALLED_APPS before fwtheme_django for correct precedence, as its templates should override those of fwtheme-django
. Similarly with orgtheme-ceda-serv and orgtheme:
'fwtheme_django_ceda_serv',
'fwtheme_django',
'orgtheme_ceda_serv',
'orgtheme',
There are two ways to enable the CEDA user status menu in the banner:
-
If using cookie based CEDA authentication, you must install the DJ Security Middleware package and include the middleware in your settings:
MIDDLEWARE = [ ... "dj_security_middleware.middleware.DJSecurityMiddleware", ]
-
If using standard Django authentication (e.g. with Django admin users or a custom authentication backend), you simply need to have reversable login and logout URLs included in your
urls.py
:urlpatterns = [ path("/login", LoginView.as_view(), name="login"), path("/logout", LogoutView.as_view(), name="logout"), ]
If you wish to use names other than "login" and "logout", you can declare them in settings. For example, if you are using the recommended OIDC authentication backend for CEDA accounts, you would set your URLs like this:
LOGIN_URL_NAME = "oidc_authentication_init" LOGOUT_URL_NAME = "oidc_logout"
While not recommended, it is possible to configure the user status block to include an HTTP GET call for logout, instead of a form POST:
LOGOUT_WITH_POST = False
This setting is True
by default.
CSS/Img static files can be found in fwtheme_django_ceda_serv/static/extra_data_centres
and the html files for each data centre are in templates/extra_data_centres
. Context processor for data centres and global datacentre dicts have now been added in context_processors.py
and default_settings.py
respectively.