Django API server for the karrot frontend
Clone or download
tiltec Conflict resolution / issues (#616)
* sketch out cases implementation

* add basic functionality

* add tests etc

* implement ties

* restructure voting api

* some more testing

* rework voting API

* fix some tests

* add some more checks

* add basic websocket implementation

* add basic notifications

* add conversation message notification email support

* add todo

* add todo

* add two email templates

* add some stats

* hide sum score when voting is ongoing

* add more notifications

* don't send notifications to users who voted already

* fix stuff

* makemessages

* fix and refine emails

* handle case if affected user leaves group during case, rewrite is_decided into status

* add case type to stats

* change endpoint from /cases to /conflict-resolution

* add history entry on user removal

* apply some throttling

* clean up

* add case participant concept

prevents new editors from joining existing cases

* optimize group API

* require minimum amount of active editors to start conflict resolution

* reword

* rename case to groupcase to avoid name clash with Django's Case

* remove affected_user from options model

* rewrite conversation type from 'group case' to 'case'

* add custom push title for case messages

* fix user removal

* test user removal notification

* tame flake8

* fix some edge cases about cancelled cases

* update messages

* add template preview handlers, fix small template problems

* make case and conversations endpoint more efficient

* reword emails

* simplify voting API

* rename to issues

* fix up renaming

* add notifications towards affected user

* rename bits and bobs
Latest commit f2e068e Jan 21, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci merge base and dev dependency files Jan 4, 2019
.tx Follow Django standard for chinese language codes Oct 23, 2018
config Conflict resolution / issues (#616) Jan 21, 2019
foodsaving Conflict resolution / issues (#616) Jan 21, 2019
grafana snapshot grafana dashboards Dec 16, 2018
mjml Bump mjml from 4.3.0 to 4.3.1 in /mjml Jan 9, 2019
.coveragerc chore: rename yunity app to foodsaving Feb 14, 2017
.editorconfig Let the CI help us with updating locales (#580) Oct 4, 2018
.gitignore Add grafana dashboard snapshot (#575) Sep 1, 2018
.pyup.yml create config file Jul 17, 2017
.style.yapf Use yapf for consistent formatting (#524) Jul 18, 2018
Dockerfile merge base and dev dependency files Jan 4, 2019
LICENSE Updating a few things in the repository. Mar 28, 2016 Focus dev setup instructions (#520) Mar 4, 2018 Focus dev setup instructions (#520) Mar 4, 2018
babel.cfg Improve message extraction (#572) Aug 6, 2018 merge base and dev dependency files Jan 4, 2019 use deploy playbook again Mar 7, 2018 Use huey queue (#496) Feb 26, 2018
pytest.ini Use circleci 2 (#484) Feb 22, 2018 downgrade to last compatible version of channels_redis Jan 21, 2019
requirements.txt downgrade to last compatible version of channels_redis Jan 21, 2019
setup.cfg ignore line break after binary operator Oct 28, 2018 merge base and dev dependency files Jan 4, 2019 Improve script Jul 19, 2018


Django API server for the karrot frontend

Our issues are tracked in karrot-frontend. We plan to unite karrot-backend, karrot-frontend and related repos in near future.

CircleCI codecov

Developer setup

The recommended way to getting your developer environment setup is docker-compose - includes backend, frontend, mail catcher, postgres, redis, etc..

Head over to yunity/karrot-docker for further instructions.

If you can't or don't want to use docker-compose, look into for other ways.

Coding guidelines

We follow PEP8 with the same rules as the Django project. As always, the coding style may not apply at some parts. You can execute flake8 in the repository root to check your code.

Code will only be accepted into master if it passes the PEP8 test.

Using the API

A live instance of karrot is running at See for API documentation. Most endpoints are only available to authenticated users. Be sure to create an account and log in to see all endpoints.


Most of karrot developers use PyCharm. We have some licenses available for the professional version. The free community edition also works well.

To get proper introspection and support from PyCharm, it's necessary to set up a virtualenv. Run this inside the backend directory:

virtualenv env
source ./env/bin/activate
pip install pip-tools

Django quick introduction

The application can be used to perform administrative tasks:

  • makemigrations: Create database migrations
  • migrate: Apply database migrations
  • shell_plus: (requires ipython) for playing in a django python environment
  • test: Run automated tests

You can launch them via docker-compose, for example:

docker-compose exec backend ./ makemigrations
docker-compose exec backend ./ migrate

If you spend too much time typing those long commands, consider creating your own bash aliases.

Parallel testing

Running the tests in parallel process can increase testing speed significantly. To execute the whole test suite on a CPU with 4 kernels, you may want to use:

docker-compose exec backend ./ test --parallel 4

Email template viewer

When editing emails it's useful to be able to see how they will be rendered.

Assuming the server is running you can visit visit localhost:8000/_templates.

To compile the .mjml templates to .html.jinja2 files you can run:

cd mjml

If you want to watch for changes, and support hot reloading then run:

./convert --watch

(refresh your browser after starting the server as the websocket is not reconnecting)

Note: you should never edit .html.jinja2 files directly.

Enjoy! ... oh and be sure to visit to find some nice components to use.