Miroir du site de l'AE UTBM https://ae.utbm.fr
Go to file
Antoine Bartuccio f052d307d7
pedagogy: make report button less visible and author more important
2019-07-08 23:16:53 +02:00
accounting small fix to follow python recommendations 2019-02-02 00:32:34 +01:00
api All: Apply Black coding rules 2018-10-05 21:52:55 +02:00
club club: fix SellingFormBase import 2019-05-21 10:53:18 +02:00
com com: use MarkdownInput for alert_msg, info_msg and index_page editing 2018-12-20 15:13:59 +01:00
core pedagogy: make report button less visible and author more important 2019-07-08 23:16:53 +02:00
counter counter: fix error for stats 500 on PermissionDenied 2019-05-28 16:39:16 +02:00
doc Update README and Markdown test assets 2017-11-09 14:37:29 +01:00
eboutic eboutic: add some help and documentation for the payment system 2019-05-27 11:20:57 +02:00
election elections: use MarkdownInput for CandidateForm 2018-12-20 16:43:59 +01:00
forum core: fix special caracter in user and forum search 2019-05-09 19:51:55 +02:00
launderette All: Apply Black coding rules 2018-10-05 21:52:55 +02:00
locale/fr/LC_MESSAGES pedagogy: make report button less visible and author more important 2019-07-08 23:16:53 +02:00
matmat All: Apply Black coding rules 2018-10-05 21:52:55 +02:00
pedagogy pedagogy: make report button less visible and author more important 2019-07-08 23:16:53 +02:00
rootplace rootplace: make code clearer and fix typos 2019-03-19 17:23:02 +01:00
sas All: Apply Black coding rules 2018-10-05 21:52:55 +02:00
sith pedagogy: fix typo for AUTUMN_AND_SPRING 2019-07-05 16:40:02 +02:00
stock All: Apply Black coding rules 2018-10-05 21:52:55 +02:00
subscription subscriptions: add date_of_birth for new users created in subscription form 2018-10-16 00:44:32 +02:00
trombi All: Apply Black coding rules 2018-10-05 21:52:55 +02:00
.coveragerc coverage: blacklist some files 2017-09-07 11:50:05 +02:00
.gitattributes Add mappings for .po and .jinja files 2019-04-22 18:20:22 +02:00
.gitignore Update Haystack indexer to use Xapian 2018-11-26 21:25:02 +01:00
.gitlab-ci.yml Update Haystack indexer to use Xapian 2018-11-26 21:25:02 +01:00
CONTRIBUTING.md core: remove external resources once for all 2019-05-18 03:00:19 +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 README: fix typo in CONTRIBUTING and move dependencies before Get started instructions 2019-04-06 20:12:47 +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 pedagogy: fix typo for AUTUMN_AND_SPRING 2019-07-05 16:40:02 +02:00
requirements.txt Update Haystack indexer to use Xapian 2018-11-26 21:25:02 +01:00

README.md

pipeline status coverage report Code style: black project chat

Sith AE

Dependencies:

See requirements.txt

You may need to install some dev libraries like libmysqlclient-dev, libssl-dev, libjpeg-dev, python3-xapian, 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 python3-dev libgraphviz-dev pkg-config python3-xapian gettext

On macos, you will need homebrew

brew install xapian

If it doesn't work it's because it need this pull request to be validated.

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

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 --system-site-packages --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

For more informations, check out the CONTRIBUTING.md file.

Logging errors with sentry

To connect the app to sentry.io, you must set the variable SENTRY_DSN in your settings custom. It's composed of the full link given on your sentry project

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.

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

sudo 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.