Cayuman makes use of poetry and python3.10 or superior. Let's go step by step
If you don't have the required python version installed then you can do so by following these instructions. Otherwise You can skip this section.
Start by installing pyenv
, a python module that makes it easy to manage several different python versions.
$ curl https://pyenv.run | bash
Then add pyenv
to .bash_profile
or your shell's profile file
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Remember to run
source ~/.bash_profile
(or whatever's the name of your shell profile file) after adding the lines above.
Now install python3.10 by doing
$ pyenv install 3.8
Now it's time to install poetry
$ pip install poetry
Then clone the repo
$ git clone git@github.com:tomgranuja/CayumanDjango.git
and install the dev environment
$ cd CayumanDjango
$ poetry install --with test
Install pre-commit hooks (to enforce coding standards)
$ poetry run pre-commit install
In order to run our tests you just have to do
$ poetry run pytest
$ poetry run python manage.py migrate
$ poetry run python manage.py createsuperuser
$ poetry run python manage.py runserver
$ poetry run python manage.py makemigrations
# Update translation file
$ poetry run python manage.py makemessages -l es
# Compile translation file
$ poetry run python manage.py compilemessages
# restart django server or webserver for changes to take effect
If there's a need to set cayuman as maintenance mode, you must run this command
$ python manage.py maintenance_mode <on|off>
These are some conventions or design decisions made by this project, which are not currently enforced by code or may not be so clear just from using it:
StudentCycle
, meaning a relationship between a student and a cycle, is only added when the student is assigned to a different cycle. There's no need to create new StudentCycle
entries for each student when periods change.Period
entries are supposed to not collide in terms of date_start
and date_end
dates. Code force them not to. Collisions by preview_date
or enrollment_start
with another period's date_end
are not prevented by code.PeriodManager.current
which returns the Period
entry corresponding to the current date according to logic mainly based on date_start
and date_end
. If no period follows this then the method returns None.StudentCycle
entries are considered to be "fully scheduled" during a period (StudentCycle.is_schedule_full == True
) depending if a student cycle entries is associated with a WorkshopPeriod
entry for each of the existing class blocks, and those WorkshopPeriods
are associated with the given period.