Miroir du site de l'AE UTBM https://ae.utbm.fr
Go to file
Skia 231922cbaa Merge branch 'sas' into 'master'
Fixed some issues with filepaths and see the future with some preload

See merge request !59
2017-03-31 11:34:10 +02:00
accounting Some com templates improvments and reordering some models 2017-03-24 09:19:15 +01:00
api Fixed markdown api issue 2016-09-06 21:59:13 +02:00
club Fix weekmail new article link 2017-03-24 14:01:05 +01:00
com Fix a weekmail deleteview, and make some translate fix 2017-03-27 15:16:01 +02:00
core Merge branch 'sas' into 'master' 2017-03-31 11:34:10 +02:00
counter Fix bug where customer can't buy an item when they have the just amount 2017-03-28 00:55:25 +02:00
doc Add report covers 2017-01-16 14:56:30 +01:00
eboutic Change is_subscriber and was_subscriber to cached_properties 2017-02-24 02:59:59 +01:00
election Change is_subscriber and was_subscriber to cached_properties 2017-02-24 02:59:59 +01:00
forum Arg, forgot another Ariadne's thread fix 2017-03-16 08:15:16 +01:00
launderette Change is_subscriber and was_subscriber to cached_properties 2017-02-24 02:59:59 +01:00
locale/fr/LC_MESSAGES Fix a weekmail deleteview, and make some translate fix 2017-03-27 15:16:01 +02:00
rootplace Big refactor: remove Subscriber class 2016-12-10 01:58:30 +01:00
sas Better to use os.path.join for paths 2017-03-30 19:13:47 +02:00
sith Pagination length in settings 2017-03-13 23:33:43 +01:00
subscription Big refactor: remove Subscriber class 2016-12-10 01:58:30 +01:00
.gitignore Don't ignore */static 2016-12-26 01:59:54 +01:00
.gitlab-ci.yml Fix CI 2016-11-08 19:27:04 +01:00
CONTRIBUTING.md Fix contributing.md and fix quantity display on eticket 2016-11-06 23:15:43 +01:00
Doxyfile Update Doxyfile 2016-06-22 14:52:53 +02:00
LICENSE Add license 2016-06-21 00:42:33 +02:00
manage.py First commit: basic users 2015-11-18 09:44:06 +01:00
migrate.py Store file moderator 2016-12-12 17:23:06 +01:00
README.md README: add counting lines of code 2017-02-27 15:41:25 +01:00
requirements.txt Add Django debug toolbar 2017-02-24 01:52:22 +01:00
TODO.md Add basic refill support 2016-06-26 20:07:29 +02:00

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)

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 .