Note
Audience: Dev
Admin Memo#
How to load the demo#
When running an instance locally, you can load the demo by running:
python manage.py load_demo
Note
If you already added some data, you might need to use --ignore-idempotent
How to load the demo in k8s#
export CI_COMMIT_REF_SLUG=$(git branch --show-current)
kubectl config use-context strass-dev
BACKEND_POD=$(kubectl get po -l branch=branch-${CI_COMMIT_REF_SLUG},role=front --output jsonpath='{.items[0].metadata.name}')
kubectl exec $BACKEND_POD --container django-container -- python manage.py load_demo
How to theme STRASS#
Some instance need specific logo, specific colors, … To comply to those needs a theme have to be made. It consists in creating a python package which will place in the application various html fragments and files in various folders. An example can be found at https://gitlab.pasteur.fr/bbrancot/django-basetheme-bootstrap-ebaii-theme
To create a new theme :
Fork the project
Rename
ebaiitoyourtheme(tips: using lower case without-or_will save you many issues)Update setup.cfg (name, version, description)
Adapte/remove html fragments in
yourtheme/templates/strass_app/Create/edit css in
yourtheme/static/css/, to include more file adapteyourtheme/templates/strass_app/extra_in_header.htmlImages can be shipped in
yourtheme/static/img/
Once push to https://gitlab.pasteur.fr/api/v4/projects/alovelace%2Fdjango-basetheme-bootstrap-mytheme you need to use the theme in the application like this:
diff --git a/src/strass/strass/settings.py b/src/strass/strass/settings.py
index 0d6c462d..889acf67 100644
--- a/src/strass/strass/settings.py
+++ b/src/strass/strass/settings.py
@@ -53,7 +53,6 @@ INSTALLED_APPS = [
'crispy_bootstrap4',
'django_kubernetes_probes',
'strass_app',
+ 'yourtheme',
]
if DEBUG or config('USE_DJANGO_EXTENSIONS', default=False, cast=bool):
index 94b6c670..14ebfb78 100644
--- a/src/strass/requirements.txt
+++ b/src/strass/requirements.txt
@@ -7,8 +7,6 @@ python-decouple
django-basetheme-bootstrap>=1.6.1
--extra-index-url https://gitlab.pasteur.fr/api/v4/projects/hub%2Fdjango-kubernetes-probes/packages/pypi/simple
django-kubernetes-probes>=1.1
+--extra-index-url https://gitlab.pasteur.fr/api/v4/projects/alovelace%2Fdjango-basetheme-bootstrap-mytheme/packages/pypi/simple
+django-basetheme-bootstrap-mytheme>=1.0.0
django-formtools
csscompressor
coverage
How to purge the review data (purge requests)#
Note
Audience: Sys admin / Dev
The purge-request feature drives the end of an evaluation cycle: applying a purge wipes all review data (reviews, recommendations and candidates) and resets reviewer/juror statuses so a new cycle can start clean.
The operation is never implicit: it is recorded as a PurgeRequest
which stays pending for a grace period of two working days before it can be
applied. Only one request can be pending at a time, and every apply/discard is
recorded with its date and the context of who/how it was closed. Jury managers
are notified by email each time a request is created, applied or discarded.
A request is created with a status choice for reviewers and jurors:
pending: on application, current reviewers/jurors lose their status and are placed back in the pending group (they will become reviewer/juror again when re-activated)unset: on application, current reviewers/jurors lose their status entirely
Once applied (the operation is transactional), for every purge request:
all
Review,RecommendationandCandidateare deletedpending reviewers/jurors lose their pending status
reviewers/jurors are removed, then re-added according to the statuses chosen at creation (
pending/unset)applications and recommendations are closed:
close_application_after,close_recommendation_afterandclose_application_edition_afterare set in the past,open_application_on(if set) in the future, every review stage stops accepting contributions and every interview session stops accepting registrations
Through the web interface#
Only jury managers can see and use the purge-request pages, available from the Recruitment management menu under Purge requests.
The list page shows all requests (status, initiator, validation date, closing context and closing date) with a New purge request button.
The creation form asks for the reviewer/juror status choices and displays a reminder that applying is irreversible and only possible after the validation date. The request is created pending and becomes appliable two working days later.
The detail page shows the request and, when the request is pending and the grace period has elapsed, offers Apply purge and Discard buttons. Both actions show a confirmation page; applying shows a red This action is irreversible warning.
Applying too soon, or acting on a request that is not pending anymore, is refused with an error message and no data is changed.
Through the admin panel#
PurgeRequest is registered in the Django admin as a
read-only model (no add/change/delete), with a Discard pending purge request
action for superusers. Discarding through the admin records the context as
Admin UI: <user email> and notifies the jury managers.
Through the management command#
Create a request#
python manage.py purge_request create \
--initiator "who/how: the request was created" \
--reviewer-status pending|unset \
--juror-status pending|unset
List the requests#
python manage.py purge_request list
Apply the pending request#
python manage.py purge_request apply --context "who triggered the apply"
Applying is only possible once the grace period has elapsed; before that the
command fails with the date from which the request becomes applicable. Use
--ignore-valide-after to bypass the grace period:
python manage.py purge_request apply --context "..." --ignore-valide-after
Discard the pending request#
python manage.py purge_request discard --context "why it was discarded"
How to remove a language#
French and English language cannot be removed as the internationalization system uses this two languages to check it soundness.
For the other language, just remove the language from LANGUAGES in src/strass/strass/settings.py.
How to add a new language#
For the call#
The first step to add a new language is not make it available for Django, do it in src/strass/strass/settings.py.
Once added the language will be available in the language menu in the top right, and call will be also proposed in this new language.
diff --git a/src/strass/strass/settings.py b/src/strass/strass/settings.py
index 889acf67..275e09d5 100644
--- a/src/strass/strass/settings.py
+++ b/src/strass/strass/settings.py
@@ -134,6 +134,7 @@ LOCALE_PATHS = [
LANGUAGES = [
('en', 'English'),
('fr', 'Français'),
+ ('de', 'German'),
]
TIME_ZONE = 'CET'
In all the application#
Note
Translating the application in a new language implies to translate ~800 text entries.
To translate the whole application is a new language the code base have to be locally cloned, virtualenv created and dependencies installed.
# create the translation file for django itself
python manage.py makemessages -l de --no-location
# create the translation file for internationalization in javascript
python manage.py makemessages -d djangojs -l de --no-location
Then edit the following file :
/src/strass/strass_app/locale/de/LC_MESSAGES/django.po
/src/strass/strass_app/locale/de/LC_MESSAGES/djangojs.po
/src/strass/locale/de/LC_MESSAGES/django.po
To validate your file, regularly run the following command.
python manage.py compilemessages --ignore *venv*