Merge branch 'makdown-editor' into 'master'
Workaround for crsf token in production for MarkdownInput See merge request ae/Sith!189
|4 weeks ago|
|accounting||1 month ago|
|api||3 months ago|
|club||4 weeks ago|
|com||4 weeks ago|
|core||4 weeks ago|
|counter||3 months ago|
|doc||1 year ago|
|eboutic||3 months ago|
|election||4 weeks ago|
|forum||4 weeks ago|
|launderette||3 months ago|
|locale/fr/LC_MESSAGES||1 month ago|
|matmat||3 months ago|
|rootplace||3 months ago|
|sas||3 months ago|
|sith||1 month ago|
|stock||3 months ago|
|subscription||3 months ago|
|trombi||3 months ago|
|.coveragerc||1 year ago|
|.gitignore||1 month ago|
|.gitlab-ci.yml||1 month ago|
|CONTRIBUTING.md||1 month ago|
|Doxyfile||2 years ago|
|LICENSE||1 year ago|
|LICENSE.old||1 year ago|
|README.md||1 month ago|
|TODO.md||2 years ago|
|manage.py||1 year ago|
|migrate.py||3 months ago|
|requirements.txt||1 month ago|
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
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
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.
You may need to install some dev libraries like
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
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
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)
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
When you need to protect an object, there are three levels:
Now you have many solutions in your model:
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.
owner_groupfield, as a ForeignKey to Group. Second is an
edit_groupsfield, 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.
sudo apt install cloc cloc --exclude-dir=doc,env .
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.