Miroir du site de l'AE UTBM https://ae.utbm.fr
Go to file
Skia d797003028 coverage: blacklist some files
Signed-off-by: Skia <skia@libskia.so>
2017-09-07 11:50:05 +02:00
accounting Small fix on accounting permissions 2017-06-26 11:17:30 +02:00
api mailing: Oups, forgot some \n in mailing format that I couldn't see at the first time 2017-08-25 16:14:02 +02:00
club mailing: Fix error when deleting user from mailing when only email provided 2017-08-24 00:20:20 +02:00
com core, com: make permanent notifications for news to moderate 2017-09-06 13:17:23 +02:00
core Allow to subscribe before subscription end 2017-09-06 19:55:14 +02:00
counter Oups, I did it again... 2017-09-02 15:31:20 +02:00
doc Add color palette creator 2017-09-02 13:41:29 +02:00
eboutic Allow disabling CB in crisis time 2017-08-24 00:14:36 +02:00
election Other line fix 2017-06-07 19:36:55 +02:00
forum forum: display only viewable topics in "last unread" 2017-09-03 12:23:26 +02:00
launderette Format launderette 2017-06-13 10:04:13 +02:00
locale/fr/LC_MESSAGES locale: make news notif translation 2017-09-06 13:19:47 +02:00
matmat Translations fix 2017-08-15 18:57:50 +02:00
rootplace Move mailing list admin to com 2017-08-22 15:36:39 +02:00
sas sas: allow ancient subscriber to add people on pictures 2017-07-26 16:55:00 +02:00
sith Allow to subscribe before subscription end 2017-09-06 19:55:14 +02:00
stock Add header to stock files 2017-04-25 16:17:04 +02:00
subscription subscription: fix tests 2017-09-07 11:21:32 +02:00
trombi trombi: make the export page 2017-08-01 13:54:35 +02:00
.coveragerc coverage: blacklist some files 2017-09-07 11:50:05 +02:00
.gitignore gitignore: ignore coverage artifacts 2017-08-29 16:45:18 +02:00
.gitlab-ci.yml CI: add coverage report 2017-08-29 16:01:01 +02:00
CONTRIBUTING.md Apply GPLv3 to Sith, and add header to every concerned file 2017-04-24 17:51:12 +02:00
Doxyfile Update Doxyfile 2016-06-22 14:52:53 +02:00
LICENSE Apply GPLv3 to Sith, and add header to every concerned file 2017-04-24 17:51:12 +02:00
LICENSE.old Apply GPLv3 to Sith, and add header to every concerned file 2017-04-24 17:51:12 +02:00
README.md CI: add coverage report 2017-08-29 16:01:01 +02:00
TODO.md Add basic refill support 2016-06-26 20:07:29 +02:00
manage.py Apply GPLv3 to Sith, and add header to every concerned file 2017-04-24 17:51:12 +02:00
migrate.py Refactor mailings email 2017-08-22 22:39:12 +02:00
requirements.txt New lite home made scss processor 2017-05-10 10:49:34 +02:00

README.md

pipeline status coverage report

Sith AE

Get started

To start working on the project, just run the following commands:

git clone https://ae-dev.utbm.fr/ae/Sith.git
cd Sith
virtualenv --clear --python=python3 env
source env/bin/activate
pip install -r requirements.txt
./manage.py setup

To start the simple development server, just run python3 manage.py runserver

Generating documentation

There is a Doxyfile at the root of the project, meaning that if you have Doxygen, you can run doxygen Doxyfile to generate a complete HTML documentation that will be available in the ./doc/html/ folder.

Dependencies:

See requirements.txt

You may need to install some dev libraries like libmysqlclient-dev, libssl-dev, libjpeg-dev, or zlib1g-dev to install all the requiered dependancies with pip. You may also need mysql-client. Don't also forget python3-dev if you don't have it already.

You can check all of them with:

sudo apt install libmysqlclient-dev libssl-dev libjpeg-dev zlib1g-dev python3-dev libffi-dev

The development is done with sqlite, but it is advised to set a more robust DBMS for production (Postgresql for example)

Collecting statics for production:

We use scss in the project. In development environment (DEBUG=True), scss is compiled every time the file is needed. For production, it assumes you have already compiled every files and to do so, you need to use the following commands :

./manage.py collectstatic # To collect statics
./manage.py compilestatic # To compile scss in those statics

Misc about development

Controlling the rights

When you need to protect an object, there are three levels:

  • Editing the object properties
  • Editing the object various values
  • Viewing the object

Now you have many solutions in your model:

  • You can define a is_owned_by(self, user), a can_be_edited_by(self, user), and/or a can_be_viewed_by(self, user) method, each returning True is the user passed can edit/view the object, False otherwise.
    This allows you to make complex request when the group solution is not powerful enough.
    It's useful too when you want to define class-wide permissions, e.g. the club members, that are viewable only for Subscribers.
  • You can add an owner_group field, as a ForeignKey to Group. Second is an edit_groups field, as a ManyToMany to Group, and third is a view_groups, same as for edit.

Finally, when building a class based view, which is highly advised, you just have to inherit it from CanEditPropMixin, CanEditMixin, or CanViewMixin, which are located in core.views. Your view will then be protected using either the appropriate group fields, or the right method to check user permissions.

Counting the number of line of code

# apt install cloc
$ cloc --exclude-dir=doc,env .

Updating doc/SYNTAX.md

If you make an update in the Markdown syntax parser, it's good to document update the syntax reference page in doc/SYNTAX.md. But updating this file will break the tests if you don't update the corresponding doc/SYNTAX.html file at the same time.
To do that, simply run ./manage.py markdown > doc/SYNTAX.html, and the tests should pass again.