Version 0.1

This commit is contained in:
François Poulain 2024-04-30 12:27:17 +02:00
commit 298abf0ba2
36 changed files with 3066 additions and 0 deletions

26
.editorconfig Normal file
View File

@ -0,0 +1,26 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{py,rst,ini}]
indent_style = space
indent_size = 4
[*.py]
line_length = 80
[*.{html,css,scss,js,json,yml}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
fournée/static/** -diff
assets/img/** -diff
assets/fonts/** -diff

41
.gitignore vendored Normal file
View File

@ -0,0 +1,41 @@
# Editors
*~
*.sw[po]
# Python
*.py[cod]
__pycache__
# Virtual environment
.env
.venv
venv
# Logs
logs
*.log
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
htmlcov
# Translations
*.mo
*.pot
# Builds
fournée/static/
docs/build/
# Databases
sqlite.db
# Local configuration
config.env
# Local overrides and variable content
local/
var/

8
CHANGELOG.md Normal file
View File

@ -0,0 +1,8 @@
# Changelog
All notable changes to Fournée will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added

661
LICENSE Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

159
Makefile Normal file
View File

@ -0,0 +1,159 @@
# -*- mode: makefile-gmake -*-
## Définition des variables
# Le nom de l'exécutable Python à utiliser (ex. python)
PYTHON_BASENAME := python3
# Configuration de l'environnement virtuel
VENV_DIR := .venv
VENV_OPT := --system-site-packages
# Définis les chemins et options des exécutables
POETRY := $(VENV_DIR)/bin/poetry
PYTHON := $(VENV_DIR)/bin/$(PYTHON_BASENAME)
PIP := $(VENV_DIR)/bin/pip
# Détermine l'environnement à utiliser.
ifndef ENV
ifdef DJANGO_SETTINGS_MODULE
ENV = $(shell echo $(DJANGO_SETTINGS_MODULE) | cut -d. -f3)
else
DEFAULT_ENV := production
ENV = $(shell \
sed -n '/^ENV/s/[^=]*=\(.*\)/\1/p' config.env 2> /dev/null \
| tail -n 1 | grep -Ee '^..*' || echo "$(DEFAULT_ENV)")
endif
endif
# Définis EDITOR pour l'édition interactive.
ifndef EDITOR
ifdef VISUAL
EDITOR := $(VISUAL)
else
EDITOR := vi
endif
endif
# Définition des cibles -------------------------------------------------------
.DEFAULT_GOAL := help
# Commentaire d'une cible : #-> interne ##-> aide production+dev ###-> aide dev
.PHONY: help
help: ## affiche cette aide
ifeq ($(ENV), production)
@perl -nle'print $& if m{^[a-zA-Z_-]+:[^#]*?## .*$$}' $(MAKEFILE_LIST) \
| sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
else
@perl -nle'print $& if m{^[a-zA-Z_-]+:[^#]*?###? .*$$}' $(MAKEFILE_LIST) \
| sort | awk 'BEGIN {FS = ":.*?###? "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
endif
.PHONY: clean
clean: clean-build clean-pyc clean-static ## nettoie tous les fichiers temporaires
.PHONY: clean-build
clean-build: ### nettoie les fichiers de construction du paquet
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
.PHONY: clean-pyc
clean-pyc: ### nettoie les fichiers temporaires python
find fournée/ \
\( -name '*.pyc' -o -name '*.pyo' -o -name '*~' \) -exec rm -f {} +
.PHONY: clean-static
clean-static: ### nettoie les fichiers "static" collectés
rm -rf var/static
.PHONY: init
init: create-venv config.env ## initialise l'environnement et l'application
@$(MAKE) --no-print-directory update
config.env:
cp config.env.example config.env
chmod go-rwx config.env
$(EDITOR) config.env
update: check-config install-deps migrate static ## mets à jour l'application et ses dépendances
touch fournée/wsgi.py
.PHONY: check
check: check-config ## vérifie la configuration de l'instance
$(PYTHON) manage.py check
.PHONY: check-config
check-config:
@find . -maxdepth 1 -name config.env -perm /o+rwx -exec false {} + || \
{ echo "\033[31mErreur :\033[0m les permissions de config.env ne sont pas bonnes, \
vous devriez au moins faire : chmod o-rwx config.env"; false; }
.PHONY: install-deps
install-deps: ## installe les dépendances de l'application
ifeq ($(ENV), production)
$(POETRY) install
else
$(POETRY) install --with dev
endif
.PHONY: migrate
migrate: ## mets à jour le schéma de la base de données
$(PYTHON) manage.py migrate
.PHONY: static
static: ## collecte les fichiers statiques
ifeq ($(ENV), production)
@echo "Collecte des fichiers statiques..."
$(PYTHON) manage.py collectstatic --no-input --verbosity 0
endif
## Cibles liées à l'environnement virtuel
.PHONY: create-venv
create-venv: $(PYTHON)
$(PYTHON):
$(shell which $(PYTHON_BASENAME)) -m venv $(VENV_OPT) $(VENV_DIR)
.PHONY: clear-venv
clear-venv: ## supprime l'environnement virtuel
-rm -rf $(VENV_DIR)
## Cibles pour le développement
.PHONY: serve
serve: ### démarre un serveur local pour l'application
$(PYTHON) manage.py runserver
.PHONY: test
test: ### lance les tests de l'application
$(PYTHON) -m pytest --cov --cov-report=term:skip-covered
.PHONY: test-wip
test-wip: #### lance les tests marqués 'wip'
$(PYTHON) -m pytest -vv -m 'wip' --pdb
.PHONY: test-failed
test-failed: #### lance les tests qui ont échoué
$(PYTHON) -m pytest --lf
.PHONY: coverage
coverage: test ### vérifie la couverture de code
$(PYTHON) -m coverage html
@echo open htmlcov/index.html
.PHONY: lint
lint: ### vérifie la syntaxe du code Python
@$(PYTHON) -m ruff check
@$(PYTHON) -m ruff format --check --quiet
.PHONY: format
format: ### formate le code Python
$(PYTHON) -m ruff check --fix
$(PYTHON) -m ruff format
.PHONY: shell
shell: ### lance un shell Python dans l'environnement
ifeq ($(ENV), production)
$(PYTHON) manage.py shell
else
$(PYTHON) manage.py shell_plus
endif

159
README.md Normal file
View File

@ -0,0 +1,159 @@
# Fournée
Organisation des fournées
**Table of content**
- [Give a try](#give-a-try)
- [Installation](#installation)
- [Deployment](#deployment)
- [Structure](#structure)
- [Development](#development)
## Give a try
On a Debian-based host - running at least Debian Stretch:
```shell
$ sudo apt install python3 virtualenv git make
$ git clone https://forge.chapril.org/fpoulain/fournée
$ cd fournée/
$ make init
# A configuration file will be created interactively; you can uncomment:
# ENV=development
$ make serve
```
Then visit [http://127.0.0.1:8000/](http://127.0.0.1:8000/) in your web browser.
## Installation
### Requirements
On a Debian-based host - running at least Debian Bullseye, you will need the
following packages:
- `python3`
- `python3-venv`
- `make`
- `git` (recommended for getting the source)
- `python3-mysqldb` (optional, in case of a MySQL / MariaDB database)
- `python3-psycopg2` (optional, in case of a PostgreSQL database)
You will also need [Poetry](https://python-poetry.org/) >=1.8 which is used to install
and manage Python dependencies. You should refer to its documentation to know
how to install it on your system.
### Quick start
It assumes that you already have the application source code locally - the best
way is by cloning this repository - and that you are in this folder.
1. Define your local configuration in a file named `config.env`, which can be
copied from `config.env.example` and edited to suits your needs.
Depending on your environment, you will have to create your database and the
user at first.
2. Run `make init`.
Note that if there is no `config.env` file, it will be created interactively.
That's it! Your environment is now initialized with the application installed.
To update it, once the source code is checked out, simply run `make update`.
You can also check that your application is well configured by running
`make check`.
## Deployment
### Web application
Here is an example deployment using NGINX - as the Web server - and uWSGI - as
the application server.
#### uWSGI
The uWSGI configuration doesn't require a special configuration, except that we
are using Python 3 and a virtual environment. Note that if you serve the
application on a sub-location, you will have to add `route-run = fixpathinfo:`
to your uWSGI configuration (available since [v2.0.11][1]).
[1]: https://uwsgi-docs.readthedocs.io/en/latest/Changelog-2.0.11.html#fixpathinfo-routing-action
#### NGINX
In the `server` block of your NGINX configuration, add the following blocks and
set the path to your application instance and to the uWSGI socket:
```nginx
location / {
include uwsgi_params;
uwsgi_pass unix:<uwsgi_socket_path>;
}
location /media {
alias <app_instance_path>/var/media;
}
location /static {
alias <app_instance_path>/var/static;
# Optional: don't log access to assets
access_log off;
}
location = /favicon.ico {
alias <app_instance_path>/var/static/favicon/favicon.ico;
# Optional: don't log access to the favicon
access_log off;
}
```
## Structure
### Overview
All the application files - e.g. Django code including settings, templates and
statics - are located into `fournée/`.
Two environments are defined - either for requirements and settings:
- `development`: for local application development and testing. It uses a
SQLite3 database and enable debugging by default, add some useful settings
and applications for development purpose - i.e. the `django-debug-toolbar`.
- `production`: for production. It checks that configuration is set and
correct, try to optimize performances and enforce some settings - i.e. HTTPS
related ones.
### Local changes
You can override and extend statics and templates locally. This can be useful
if you have to change the logo for a specific instance for example. For that,
just put your files under the `local/static/` and `local/templates/` folders.
Regarding the statics, do not forget to collect them after that. Note also that
the `local/` folder is ignored by *git*.
### Variable content
All the variable content - e.g. user-uploaded media, collected statics - are
stored inside the `var/` folder. It is also ignored by *git* as it's specific
to each application installation.
So, you will have to configure your Web server to serve the `var/media/` and
`var/static/` folders, which should point to `/media/` and `/static/`,
respectively.
## Development
The easiest way to deploy a development environment is by using the `Makefile`.
Before running `make init`, ensure that you have either set `ENV=development`
in the `config.env` file or have this environment variable. Note that you can
still change this variable later and run `make init` again.
There is some additional rules when developing, which are mainly wrappers for
`manage.py`. You can list all of them by running `make help`. Here are the main ones:
- `make serve`: run a development server
- `make test`: test the whole application
- `make lint`: check the Python code syntax
## License
Fournée is developed by Cliss XXI and licensed under the [AGPLv3+](LICENSE).

113
config.env.example Normal file
View File

@ -0,0 +1,113 @@
###########################################################
# #
# Edit the following configuration to suits your needs. #
# #
###########################################################
###############################################################################
# MAIN SETTINGS
###############################################################################
# Whether this configuration file has higher priority than the environment
# variables.
#
# Note that you should keep this configuration file with a higher priority if
# the application can be reloaded (e.g. by uWSGI).
#
# Default is 'True'.
#CONFIG_PRIORITY_TO_FILE=True
# Environment to use within the application.
#
# The environment is used to load the proper settings for your application
# instance. There is two ways for defining it, with the following precedence:
# - DJANGO_SETTINGS_MODULE: the Python path to the settings module to use. It
# allows you to define and use your own settings module. Use it with care!
# Note: the module name will be used as the environment.
# - ENV: the environment to use, which is one of 'production' or 'development'.
#
# Default is the 'production' environment.
#ENV=production
#ENV=development
# The secret key used to provide cryptographic signing.
#
# It should be set to a unique, unpredictable value. On a GNU/Linux system, you
# could generate a new one with:
#
# $ head -c50 /dev/urandom | base64
#
# /!\ Required in production.
#DJANGO_SECRET_KEY=CHANGEME!!!
# The base URL on which the application is served without trailing slash.
#
# It is typically used for generating URLs to include in notification emails.
#
# /!\ Required in production.
#BASE_URL=https://example.org
# A coma-separated string representing the host/domain names that this
# application instance can serve.
#
# /!\ Required in production.
#DJANGO_ALLOWED_HOSTS=example.org,
###############################################################################
# DATABASE SETTINGS
###############################################################################
# Database configuration, as an URI.
#
# In production, the recommended database backend for better performances is
# PostgreSQL - or MySQL if you prefer.
#
# Default is a SQLite database in development only.
#
# /!\ Required in production.
#DJANGO_DATABASE_URL=postgres://user:password@127.0.0.1:5432/fournée
#DJANGO_DATABASE_URL=mysql://user:password@127.0.0.1:3306/fournée
###############################################################################
# EMAIL SETTINGS
###############################################################################
# Email configuration for sending messages, as an URI.
#
# In production, you should either use a local SMTP server or a relay one. The
# URI will be in that case of the form:
#
# PROTOCOL://[USER:PASSWORD@]HOST[:PORT]
#
# PROTOCOL can be smtp, smtp+ssl or smtp+tls. Note that special characters
# in USER and PASSWORD - e.g. @ - must be escaped. It can be achieve with:
#
# $ python3 -c 'from urllib.parse import quote as q;print(q("USER")+":"+q("PASSWORD"))'
#
# Default is the local SMTP server in production and the console in development.
#DJANGO_EMAIL_URL=smtp://localhost:25
# Default email address to use for various automated correspondence.
#
# /!\ Required in production.
#DEFAULT_FROM_EMAIL=webmaster@example.org
# A comma separated list of all the people who get production error
# notifications, following rfc2822 format
#ADMINS="Webmaster <webmaster@example.org>"
###############################################################################
# MISC SETTINGS
###############################################################################
# Base directory of the app instance, where the local and var folders are
# located.
#
# Default is the current directory.
#BASE_DIR=
# Turn on/off debug mode.
#
# Note that it's always disabled in production.
#DJANGO_DEBUG=off
#DJANGO_DEBUG_TOOLBAR=on

1
fournée/__init__.py Normal file
View File

@ -0,0 +1 @@
__version__ = "0.1.0"

View File

325
fournée/core/admin.py Normal file
View File

@ -0,0 +1,325 @@
from datetime import date, timedelta
from decimal import Decimal
from django.contrib import admin, messages
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.safestring import mark_safe
import nested_admin
from . import models
class MyAdminSite(admin.AdminSite):
site_header = "Fournée 2.0"
index_title = (
"Une interface de gestion offerte par Django (et un peu de sueur)"
)
admin_site = MyAdminSite(name="admin")
class PainAdmin(admin.ModelAdmin):
list_display = ["nom", "pâte", "poids", "moulé"]
list_editable = ["pâte", "poids", "moulé"]
list_select_related = ["pâte"]
actions = None
save_as = True
admin_site.register(models.Pain, PainAdmin)
class IngrédientInline(admin.TabularInline):
model = models.Ingrédient
sortable_field_name = "ordre"
extra = 1
class RecetteAdmin(admin.ModelAdmin):
inlines = [
IngrédientInline,
]
actions = None
save_as = True
admin_site.register(models.Recette, RecetteAdmin)
class MyDateFieldListFilter(admin.filters.DateFieldListFilter):
def __init__(self, field, request, params, model, model_admin, field_path):
super().__init__(field, request, params, model, model_admin, field_path)
self.links = (
self.links[0:1]
+ (
(
"Demain",
{
self.lookup_kwarg_since: str(
date.today() + timedelta(days=1)
),
self.lookup_kwarg_until: str(
date.today() + timedelta(days=2)
),
},
),
)
+ self.links[1:]
)
class RéservationAdmin(admin.ModelAdmin):
model = models.Réservation
actions = None
list_display = ["pour", "date", "pain", "quantité", "fournée"]
list_display_links = ["fournée"]
list_filter = [
("commande__fournée__date", MyDateFieldListFilter),
"commande__pour",
"commande__fournée__pour",
"pain",
]
list_editable = ["pain", "quantité"]
list_select_related = ["commande", "commande__fournée"]
@admin.display(ordering="commande__pour")
def pour(self, obj):
return obj.commande.pour
@admin.display(ordering="commande__fournée__pour")
def fournée(self, obj):
return mark_safe(
'<a href="{}">{}</a>'.format(
reverse(
"admin:core_fournée_change", args=(obj.commande.fournée.pk,)
),
obj.commande.fournée.pour,
)
)
@admin.display(ordering="commande__fournée__date")
def date(self, obj):
return obj.commande.fournée.date
admin_site.register(models.Réservation, RéservationAdmin)
class RéservationInline(nested_admin.NestedTabularInline):
model = models.Réservation
extra = 1
classes = ["collapse"]
class CommandeInline(nested_admin.NestedStackedInline):
model = models.Commande
inlines = [
RéservationInline,
]
extra = 1
classes = ["collapse"]
class CouléeInline(
nested_admin.SortableHiddenMixin, nested_admin.NestedTabularInline
):
model = models.Coulée
extra = 0
classes = ["collapse"]
sortable_field_name = "ordre"
class FournéeAdmin(nested_admin.NestedModelAdmin):
change_form_template = "admin/fournée_change_form.html"
inlines = [
CommandeInline,
CouléeInline,
]
actions = None
extra = 1
list_filter = [("date", MyDateFieldListFilter), "commande__fournée__pour"]
date_hierarchy = "date"
save_as = True
save_on_top = True
def save_related(self, request, form, formsets, change):
"""Création des coulées manquantes"""
super().save_related(request, form, formsets, change)
if change and "_continueandcreatecoulees" in request.POST:
obj = form.instance
"""Pour chaque pâte on regarde si les coulées sont complètes.
Si elles ne le sont pas, on ajoute ce qui manque."""
for pâte_id, pâte_nom in (
obj.commande_set.values_list(
"réservation__pain__pâte", "réservation__pain__pâte__nom"
)
.order_by("réservation__pain__pâte")
.distinct()
):
somme_commandée = obj.masse_commandée(pâte_id)
somme_coulée = sum(
obj.coulée_set.filter(pâte_id=pâte_id).values_list(
"quantité", flat=True
)
)
pâte_manquante = somme_commandée - somme_coulée
if pâte_manquante > 0:
obj.coulée_set.create(
pâte_id=pâte_id, quantité=pâte_manquante
)
self.message_user(
request,
f"Création d'une coulée de {pâte_manquante.normalize()} kg pour la pâte {pâte_nom}.",
)
elif pâte_manquante < 0:
self.message_user(
request,
f"Attention la pâte {pâte_nom} est prévue en excès ({-pâte_manquante.normalize()} kg en trop)",
messages.WARNING,
)
def save_model(self, request, obj, form, change):
"""Décale d'une semaine en cas de save_as si c'est utile"""
if not change:
date = form.cleaned_data.get("date", None)
if obj._meta.model.objects.filter(date=date).exists():
prochaine_date = date + timedelta(weeks=1)
if not obj._meta.model.objects.filter(
date=prochaine_date
).exists():
obj.date = date + timedelta(weeks=1)
super().save_model(request, obj, form, change)
def response_post_save_change(self, request, obj):
"""Hack la réponse pour forcer un _continue sans hacker tout
le fichier nested_admin/nested.py"""
if "_continueandcreatecoulees" in request.POST:
return redirect("admin:core_fournée_change", obj.pk)
else:
return super().response_change(request, obj)
def change_view(self, request, object_id, form_url="", extra_context=None):
extra_context = extra_context or {}
obj = self.model.objects.get(pk=object_id)
extra_context["commandes"] = obj.commande_set.all()
coulées = obj.coulée_set.all()
ingrédients = sorted(
set(
coulées.values_list(
"pâte__ingrédient__nom", "pâte__ingrédient__ordre"
)
),
key=lambda x: x[1],
)
extra_context["ingrédients"] = ingrédients
""" on créé un tableau coulée / ingrédient """
extra_context["coulées"] = []
for c in obj.coulée_set.all():
tmp = [c]
for i, _ in ingrédients:
if c.pâte.ingrédient_set.filter(nom=i).exists():
tmp.append(
(c.quantité / c.pâte.poids_de_base * sum(
c.pâte.ingrédient_set.filter(nom=i).values_list("quantité", flat=True)
)).quantize(Decimal('1.000')).normalize()
)
else:
tmp.append("")
masse_coulée = sum(
obj.coulée_set.filter(pâte=c.pâte).values_list(
"quantité", flat=True
)
)
masse_commandée = obj.masse_commandée(c.pâte_id)
if masse_coulée == masse_commandée:
problems = ""
elif masse_coulée > masse_commandée:
problems = f"{(masse_coulée - masse_commandée).normalize()} kg coulés en trop !!"
elif masse_coulée < masse_commandée:
problems = f"{(masse_commandée - masse_coulée).normalize()} kg coulés en moins !!"
extra_context["coulées"].append([problems, tmp])
pains = set(obj.commande_set.values_list("pains__nom", flat=True))
totaux = []
for i, _ in ingrédients:
total = sum([
qté * qté_unit / unit
for qté, qté_unit, unit in
obj.coulée_set.filter(pâte__ingrédient__nom=i)
.values_list('quantité', 'pâte__ingrédient__quantité', 'pâte__poids_de_base')
]).quantize(Decimal('1.000')).normalize()
totaux.append(total)
extra_context["totaux_coulées"] = totaux
""" liste des pains, vérifiant s'ils sont coulés """
extra_context["pains"] = [
(not obj.coulée_set.filter(pâte__pain__nom=p).exists(), p)
for p in pains
]
""" on créé un tableau pains / commande """
extra_context["divisions"] = []
for c in obj.commande_set.all():
tmp = [c.pour]
for p in pains:
if c.réservation_set.filter(pain__nom=p).exists():
tmp.append(
sum(
c.réservation_set.filter(pain__nom=p).values_list(
"quantité", flat=True
)
).normalize()
)
else:
tmp.append("")
extra_context["divisions"].append(tmp)
totaux = []
for p in pains:
total = sum(
obj.commande_set.filter(pains__nom=p).values_list(
"réservation__quantité", flat=True
)
).normalize()
totaux.append(total)
extra_context["totaux_divisions"] = totaux
return super().change_view(
request,
object_id,
form_url,
extra_context=extra_context,
)
admin_site.register(models.Fournée, FournéeAdmin)
class CouléeAdmin(admin.ModelAdmin):
model = models.Coulée
actions = None
list_display = ["pâte", "quantité", "date", "fournée_pour"]
list_display_links = ["fournée_pour"]
list_filter = [("fournée__date", MyDateFieldListFilter), "pâte"]
list_editable = ["pâte", "quantité"]
list_select_related = ["fournée"]
@admin.display(ordering="fournée__pour")
def fournée_pour(self, obj):
return mark_safe(
'<a href="{}">{}</a>'.format(
reverse("admin:core_fournée_change", args=(obj.fournée.pk,)),
obj.fournée.pour,
)
)
@admin.display(ordering="fournée__date")
def date(self, obj):
return obj.fournée.date
admin_site.register(models.Coulée, CouléeAdmin)

6
fournée/core/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class CoreConfig(AppConfig):
name = "fournée.core"
verbose_name = "Gestion des fournées"

View File

@ -0,0 +1,146 @@
# Generated by Django 4.2.11 on 2024-04-29 16:46
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Commande",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("nom", models.CharField(max_length=64)),
],
),
migrations.CreateModel(
name="Fournée",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("date", models.DateField()),
("pour", models.CharField(max_length=64)),
],
),
migrations.CreateModel(
name="Pain",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("nom", models.CharField(max_length=64)),
("poids", models.DecimalField(decimal_places=3, max_digits=6)),
("moulé", models.BooleanField()),
],
),
migrations.CreateModel(
name="Recette",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("nom", models.CharField(max_length=64)),
("poids_de_base", models.DecimalField(decimal_places=3, max_digits=6)),
],
),
migrations.CreateModel(
name="Réservation",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("pour", models.CharField(max_length=64)),
("quantité", models.DecimalField(decimal_places=3, max_digits=6)),
(
"commande",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.commande"
),
),
(
"pain",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.pain"
),
),
],
),
migrations.AddField(
model_name="pain",
name="pâte",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.recette"
),
),
migrations.CreateModel(
name="Ingrédient",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("nom", models.CharField(max_length=64)),
("quantité", models.DecimalField(decimal_places=3, max_digits=6)),
(
"recette",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.recette"
),
),
],
),
migrations.AddField(
model_name="commande",
name="fournée",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.fournée"
),
),
migrations.AddField(
model_name="commande",
name="pains",
field=models.ManyToManyField(through="core.Réservation", to="core.pain"),
),
]

View File

@ -0,0 +1,21 @@
# Generated by Django 4.2.11 on 2024-04-29 16:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("core", "0001_initial"),
]
operations = [
migrations.RenameField(
model_name="commande",
old_name="nom",
new_name="pour",
),
migrations.RemoveField(
model_name="réservation",
name="pour",
),
]

View File

@ -0,0 +1,68 @@
# Generated by Django 4.2.11 on 2024-04-30 10:18
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0002_rename_nom_commande_pour_remove_réservation_pour"),
]
operations = [
migrations.AlterModelOptions(
name="commande",
options={"ordering": ["pour"]},
),
migrations.AlterModelOptions(
name="fournée",
options={"ordering": ["-date"]},
),
migrations.AlterModelOptions(
name="ingrédient",
options={"ordering": ["-quantité"]},
),
migrations.AlterModelOptions(
name="pain",
options={"ordering": ["pâte", "poids", "moulé"]},
),
migrations.AlterModelOptions(
name="recette",
options={"ordering": ["nom"]},
),
migrations.AlterModelOptions(
name="réservation",
options={"ordering": ["pain", "commande__pour", "commande__fournée__date"]},
),
migrations.CreateModel(
name="Coulée",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("ordre", models.SmallIntegerField(default=0)),
("quantité", models.DecimalField(decimal_places=3, max_digits=6)),
(
"fournée",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.fournée"
),
),
(
"pâte",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.recette"
),
),
],
options={
"ordering": ["fournée__date", "ordre", "quantité", "pâte"],
},
),
]

View File

@ -0,0 +1,21 @@
# Generated by Django 4.2.11 on 2024-05-02 17:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0003_alter_commande_options_alter_fournée_options_and_more"),
]
operations = [
migrations.AlterModelOptions(
name="ingrédient",
options={"ordering": ["ordre", "-quantité"]},
),
migrations.AddField(
model_name="ingrédient",
name="ordre",
field=models.SmallIntegerField(default=0),
),
]

View File

97
fournée/core/models.py Normal file
View File

@ -0,0 +1,97 @@
from django.db import models
class Fournée(models.Model):
class Meta:
ordering = ["-date"]
date = models.DateField()
pour = models.CharField(max_length=64)
def __str__(self):
return f"Fournée du {self.date: %d-%m-%Y} pour {self.pour}"
def masse_commandée(self, pâte_id):
"Renvoie la masse commandée d'une pâte donnée"
poids_qté = self.commande_set.filter(réservation__pain__pâte_id=pâte_id).values('réservation__pain__poids', 'réservation__quantité')
return sum([c['réservation__quantité'] * c['réservation__pain__poids'] for c in poids_qté])
class Ingrédient(models.Model):
class Meta:
ordering = ["ordre", "-quantité"]
recette = models.ForeignKey("Recette", on_delete=models.CASCADE)
nom = models.CharField(max_length=64)
quantité = models.DecimalField(max_digits=6, decimal_places=3)
ordre = models.SmallIntegerField(default=0)
def __str__(self):
return f"{self.nom} ({self.quantité} kg)"
class Recette(models.Model):
class Meta:
ordering = ["nom"]
nom = models.CharField(max_length=64)
poids_de_base = models.DecimalField(max_digits=6, decimal_places=3)
def __str__(self):
return self.nom
class Pain(models.Model):
class Meta:
ordering = ["pâte", "poids", "moulé"]
nom = models.CharField(max_length=64)
pâte = models.ForeignKey("Recette", on_delete=models.CASCADE)
poids = models.DecimalField(max_digits=6, decimal_places=3)
moulé = models.BooleanField()
def __str__(self):
return self.nom
class Réservation(models.Model):
class Meta:
ordering = ["pain", "commande__pour", "commande__fournée__date"]
quantité = models.DecimalField(max_digits=6, decimal_places=3)
pain = models.ForeignKey("Pain", on_delete=models.CASCADE)
commande = models.ForeignKey("Commande", on_delete=models.CASCADE)
def __str__(self):
return f"{self.quantité.normalize()} {self.pain}"
class Commande(models.Model):
class Meta:
ordering = ["pour"]
pour = models.CharField(max_length=64)
pains = models.ManyToManyField("Pain", through="Réservation")
fournée = models.ForeignKey("Fournée", on_delete=models.CASCADE)
def __str__(self):
details = ""
if self.id and self.réservation_set.exists():
details = " (" + ", ".join(
[str(r) for r in self.réservation_set.all()]
) + ")"
return f"{self.pour}" + details
class Coulée(models.Model):
class Meta:
ordering = ["fournée__date", "ordre", "quantité", "pâte"]
ordre = models.SmallIntegerField(default=0)
quantité = models.DecimalField(max_digits=6, decimal_places=3)
pâte = models.ForeignKey("Recette", on_delete=models.CASCADE)
fournée = models.ForeignKey("Fournée", on_delete=models.CASCADE)
def __str__(self):
return f"{self.pâte} ({self.quantité.normalize()} kg)"

View File

@ -0,0 +1,15 @@
from django import template
from django.contrib.admin.templatetags.admin_modify import submit_row
from django.contrib.admin.templatetags.base import InclusionAdminNode
register = template.Library()
@register.tag(name="fournée_submit_row")
def submit_row_tag(parser, token):
return InclusionAdminNode(
parser, token, func=submit_row, template_name="fournée_submit_line.html"
)

View File

View File

@ -0,0 +1,29 @@
import environ
"""The default environment to use."""
DEFAULT_ENVIRONMENT = "production"
"""The environment variables of the app instance."""
env = environ.Env()
"""Path to the package root - e.g. Django project."""
root_dir = environ.Path(__file__) - 2
"""Path to the base directory of the app instance."""
base_dir = env.path("BASE_DIR", default=str(root_dir - 1))
# Load config.env, OS environment variables will take precedence unless
# CONFIG_PRIORITY_TO_FILE is set to `True` - the default. This way, this
# configuration file will be read again when the application is reloaded.
env.read_env(
base_dir("config.env"),
overwrite=env.bool("CONFIG_PRIORITY_TO_FILE", default=True),
)
"""The Django settings module"s name to use."""
DJANGO_SETTINGS_MODULE = env(
"DJANGO_SETTINGS_MODULE",
default="fournée.settings.{}".format(
env("ENV", default=DEFAULT_ENVIRONMENT)
),
)

227
fournée/settings/base.py Normal file
View File

@ -0,0 +1,227 @@
"""
Django settings for Fournée project.
For more information on this file, see
https://docs.djangoproject.com/en/stable/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/stable/ref/settings/
"""
import os.path
from email.utils import getaddresses
from urllib.parse import urlparse
from . import base_dir, env, root_dir
# ENVIRONMENT VARIABLES AND PATHS
# ------------------------------------------------------------------------------
# Local directory used for static and templates overrides
local_dir = base_dir.path("local")
# Directory for variable stuffs, i.e. user-uploaded media
var_dir = base_dir.path("var")
if not os.path.isdir(var_dir()):
os.mkdir(var_dir(), mode=0o755)
# Base URL on which the application is served without trailing slash
BASE_URL = env("BASE_URL", default="http://127.0.0.1:8000")
# Location on which the application is served
APP_PATH = urlparse(BASE_URL).path or "/"
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#debug
DEBUG = env.bool("DJANGO_DEBUG", default=True)
# Local time zone for this installation
TIME_ZONE = "Europe/Paris"
# https://docs.djangoproject.com/en/stable/ref/settings/#language-code
LANGUAGE_CODE = "fr"
# https://docs.djangoproject.com/en/stable/ref/settings/#site-id
SITE_ID = 1
# https://docs.djangoproject.com/en/stable/ref/settings/#use-tz
USE_TZ = True
# DATABASES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#databases
# https://django-environ.readthedocs.io/en/stable/#supported-types
DATABASES = {
"default": env.db(
"DJANGO_DATABASE_URL",
default="sqlite:///{}".format(base_dir("sqlite.db")),
)
}
# https://docs.djangoproject.com/en/stable/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
# URLS
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#root-urlconf
ROOT_URLCONF = "fournée.urls"
# https://docs.djangoproject.com/en/stable/ref/settings/#wsgi-application
WSGI_APPLICATION = "fournée.wsgi.application"
# APP CONFIGURATION
# ------------------------------------------------------------------------------
DJANGO_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
]
# Project dependencies
THIRD_PARTY_APPS = ["nested_admin"]
# Project applications
LOCAL_APPS = ["fournée.core"]
# https://docs.djangoproject.com/en/stable/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
# PASSWORDS
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/topics/auth/passwords/#password-validation
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": (
"django.contrib.auth.password_validation."
"UserAttributeSimilarityValidator"
)
},
{
"NAME": (
"django.contrib.auth.password_validation.MinimumLengthValidator"
)
},
{
"NAME": (
"django.contrib.auth.password_validation.CommonPasswordValidator"
)
},
{
"NAME": (
"django.contrib.auth.password_validation."
"NumericPasswordValidator"
)
},
]
# MIDDLEWARE
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#middleware
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
# STATIC
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#static-files
STATIC_ROOT = var_dir("static")
# https://docs.djangoproject.com/en/stable/ref/settings/#static-url
STATIC_URL = os.path.join(APP_PATH, "static/")
# https://docs.djangoproject.com/en/stable/ref/settings/#staticfiles-dirs
STATICFILES_DIRS = [root_dir("static")]
if os.path.isdir(local_dir("static")):
STATICFILES_DIRS.insert(0, local_dir("static"))
# https://docs.djangoproject.com/en/stable/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = [
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
]
# MEDIA
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#media-root
MEDIA_ROOT = var_dir("media")
# https://docs.djangoproject.com/en/stable/ref/settings/#media-url
MEDIA_URL = os.path.join(APP_PATH, "media/")
# https://docs.djangoproject.com/en/stable/ref/settings/#file-upload-directory-permissions
FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755
# https://docs.djangoproject.com/en/stable/ref/settings/#file-upload-permissions
FILE_UPLOAD_PERMISSIONS = 0o644
# TEMPLATES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#templates
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [root_dir("templates")],
"OPTIONS": {
"debug": DEBUG,
"loaders": [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
],
},
}
]
if os.path.isdir(local_dir("templates")):
TEMPLATES[0]["DIRS"].insert(0, local_dir("templates"))
# FIXTURES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#fixture-dirs
FIXTURE_DIRS = [root_dir("fixtures")]
# EMAIL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/topics/email/#email-backends
# https://django-environ.readthedocs.io/en/stable/#supported-types
vars().update(env.email_url("DJANGO_EMAIL_URL", default="smtp://localhost:25"))
DEFAULT_FROM_EMAIL = env("DEFAULT_FROM_EMAIL", default="webmaster@localhost")
# Use the same email address for error messages
SERVER_EMAIL = DEFAULT_FROM_EMAIL
# ADMIN
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#admins
ADMINS = getaddresses([env("ADMINS", default="Cliss XXI <tech@cliss21.com>")])
# https://docs.djangoproject.com/en/stable/ref/settings/#managers
MANAGERS = ADMINS
# SESSIONS AND COOKIES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#session-cookie-path
SESSION_COOKIE_PATH = APP_PATH
# https://docs.djangoproject.com/en/stable/ref/settings/#csrf-cookie-path
CSRF_COOKIE_PATH = APP_PATH
# ------------------------------------------------------------------------------
# APPLICATION AND 3RD PARTY LIBRARY SETTINGS
# ------------------------------------------------------------------------------

View File

@ -0,0 +1,46 @@
"""
Development settings.
- use Console backend for emails sending by default
- add the django-debug-toolbar
"""
from .base import * # noqa
from .base import INSTALLED_APPS, MIDDLEWARE, env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#secret-key
SECRET_KEY = env("DJANGO_SECRET_KEY", default="CHANGEME!!!")
# https://docs.djangoproject.com/en/stable/ref/settings/#allowed-hosts
ALLOWED_HOSTS = env.list(
"DJANGO_ALLOWED_HOSTS", default=["localhost", "0.0.0.0", "127.0.0.1"]
)
# EMAIL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/topics/email/#email-backends
# https://django-environ.readthedocs.io/en/stable/#supported-types
vars().update(env.email_url("DJANGO_EMAIL_URL", default="consolemail://"))
# ------------------------------------------------------------------------------
# APPLICATION AND 3RD PARTY LIBRARY SETTINGS
# ------------------------------------------------------------------------------
# DJANGO DEBUG TOOLBAR
# ------------------------------------------------------------------------------
# https://django-debug-toolbar.readthedocs.io/en/stable/installation.html
if env.bool("DJANGO_DEBUG_TOOLBAR", default=False):
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
INSTALLED_APPS += ["debug_toolbar"]
INTERNAL_IPS = ["127.0.0.1"]
DEBUG_TOOLBAR_CONFIG = {
"DISABLE_PANELS": ["debug_toolbar.panels.redirects.RedirectsPanel"],
"SHOW_TEMPLATE_CONTEXT": True,
}
# DJANGO EXTENSIONS
# ------------------------------------------------------------------------------
# https://django-extensions.readthedocs.io/en/stable/index.html
INSTALLED_APPS += ["django_extensions"]

View File

@ -0,0 +1,121 @@
"""
Production settings.
- validate the configuration
- disable debug mode
- load secret key from environment variables
- set other production configurations
"""
import os
from django.core.exceptions import ImproperlyConfigured
from .base import * # noqa
from .base import TEMPLATES, env, var_dir
# CONFIGURATION VALIDATION
# ------------------------------------------------------------------------------
# Ensure that the database configuration has been set
if not env("DJANGO_DATABASE_URL", default=None):
raise ImproperlyConfigured(
"No database configuration has been set, you should check "
"the value of your DATABASE_URL environment variable."
)
# Ensure that the default email address has been set
if not env("DEFAULT_FROM_EMAIL", default=None):
raise ImproperlyConfigured(
"No default email address has been set, you should check "
"the value of your DEFAULT_FROM_EMAIL environment variable."
)
# Ensure that the base URL has been set
if not env("BASE_URL", default=None):
raise ImproperlyConfigured(
"No base URL of the application has been set, you should check "
"the value of your BASE_URL environment variable."
)
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#debug
DEBUG = False
# https://docs.djangoproject.com/en/stable/ref/settings/#secret-key
SECRET_KEY = env("DJANGO_SECRET_KEY")
# https://docs.djangoproject.com/en/stable/ref/settings/#allowed-hosts
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=[])
# STATIC
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#static-files
STATICFILES_STORAGE = (
"django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
)
# TEMPLATES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#templates
TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG
TEMPLATES[0]["OPTIONS"]["loaders"] = [
(
"django.template.loaders.cached.Loader",
[
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
)
]
# LOGGING
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/topics/logging/
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {
"format": "%(asctime)s - %(levelname)s - %(module)s: %(message)s"
}
},
"handlers": {
"mail_admins": {
"level": "ERROR",
"class": "django.utils.log.AdminEmailHandler",
},
"file": {
"level": "DEBUG",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": var_dir("log/fournée.log"),
"formatter": "verbose",
"when": "midnight",
"interval": 1,
"backupCount": 30,
},
},
"loggers": {
"django": {
"level": "WARNING",
"handlers": ["file"],
"propagate": True,
},
"django.request": {
"level": "WARNING",
"handlers": ["file", "mail_admins"],
"propagate": True,
},
"fournée": {
"level": "INFO",
"handlers": ["file", "mail_admins"],
"propagate": True,
},
},
}
if not os.path.isdir(var_dir("log")):
os.mkdir(var_dir("log"), mode=0o750)
# ------------------------------------------------------------------------------
# APPLICATION AND 3RD PARTY LIBRARY SETTINGS
# ------------------------------------------------------------------------------

55
fournée/settings/test.py Normal file
View File

@ -0,0 +1,55 @@
"""
With these settings, tests run faster.
"""
from .base import * # noqa
from .base import TEMPLATES, env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#debug
DEBUG = False
# https://docs.djangoproject.com/en/stable/ref/settings/#secret-key
SECRET_KEY = env("DJANGO_SECRET_KEY", default="CHANGEME!!!")
# https://docs.djangoproject.com/en/stable/ref/settings/#test-runner
TEST_RUNNER = "django.test.runner.DiscoverRunner"
# CACHES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#caches
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "",
}
}
# PASSWORDS
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#password-hashers
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
# TEMPLATES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#templates
TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG
TEMPLATES[0]["OPTIONS"]["loaders"] = [
(
"django.template.loaders.cached.Loader",
[
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
)
]
# EMAIL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/stable/ref/settings/#email-backend
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
# https://docs.djangoproject.com/en/stable/ref/settings/#email-host
EMAIL_HOST = "localhost"
# https://docs.djangoproject.com/en/stable/ref/settings/#email-port
EMAIL_PORT = 1025

View File

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block title %}Page introuvable{% endblock %}
{% block content %}
<p>La page que vous demandez semble introuvable...</p>
{% endblock %}

View File

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block title %}Erreur interne{% endblock %}
{% block content %}
<p>Une erreur inattendue est survenue...</p>
{% endblock %}

View File

@ -0,0 +1,91 @@
{% extends "admin/change_form.html" %}
{% load i18n admin_urls static admin_modify fournée_modify %}
{% if save_on_top %}{% block submit_buttons_top %}{% fournée_submit_row %}{% endblock %}{% endif %}
{% block submit_buttons_bottom %}{% fournée_submit_row %}{% endblock %}
{% block after_field_sets %}
{% if commandes %}
<h2>Résumé des commandes</h2>
<ul>
{% for commande in commandes %}
<li>{{ commande }}</li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
{% block after_related_objects %}
{% if coulées %}
<h2>Résumé des coulées</h2>
<table>
<thead>
<tr>
<th></th>
{% for i, _ in ingrédients %}
<th scope="col" style="text-align:center">{{ i }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for problems, coulée in coulées %}
<tr{% if problems %} style="color: var(--delete-button-hover-bg);"{% endif %}>
{% for i in coulée %}
{% if forloop.first %}<th scope="row">{% else %}<td style="text-align:center">{% endif %}
{{ i }}
{% if forloop.first %}{% if problems %} ({{ problems }}){% endif %}</th>{% else %}</td>{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr><td colspan={{totaux_coulées | length | add:"1" }}></td></tr>
<tr><td colspan={{totaux_coulées | length | add:"1" }}></td></tr>
<tr>
<th>Totaux</th>
{% for p in totaux_coulées %}
<th scope="col" style="text-align:center">{{ p }}</th>
{% endfor %}
</tr>
</tfoot>
</table>
<p></p>
{% endif %}
{% if divisions %}
<hr>
<h2>Résumé des divisions</h2>
<table>
<thead>
<tr>
<th></th>
{% for problems, p in pains %}
<th scope="col"{% if problems %} style="color: var(--delete-button-hover-bg);"{% endif %}>{{ p }}{% if problems %}<br>sans coulée{% endif %}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for commande in divisions %}
<tr>
{% for p in commande %}
{% if forloop.first %}<th scope="row">{% else %}<td style="text-align:center">{% endif %}
{{ p }}
{% if forloop.first %}</th>{% else %}</td>{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr><td colspan={{totaux_divisions | length | add:"1" }}></td></tr>
<tr><td colspan={{totaux_divisions | length | add:"1" }}></td></tr>
<tr>
<th>Totaux</th>
{% for p in totaux_divisions %}
<th scope="col" style="text-align:center">{{ p }}</th>
{% endfor %}
</tr>
</tfoot>
</table>
<p></p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,16 @@
{% load i18n admin_urls %}
<div class="submit-row">
{% block submit-row %}
{% if show_save_and_continue %}<input type="submit" value="{% translate 'Save' %}" class="default" name="_continue">{% endif %}
<input type="submit" value="Enregistrer et générer les coulées" style="margin-left: auto;" name="_continueandcreatecoulees">
{% if show_save_as_new %}<input type="submit" value="Copier vers un nouveau" name="_saveasnew">{% endif %}
{% if show_close %}
{% url opts|admin_urlname:'changelist' as changelist_url %}
<a href="{% add_preserved_filters changelist_url %}" class="closelink">{% translate 'Close' %}</a>
{% endif %}
{% if show_delete_link and original %}
{% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
<a href="{% add_preserved_filters delete_url %}" style="margin-left: 0;" class="deletelink">{% translate "Delete" %}</a>
{% endif %}
{% endblock %}
</div>

View File

@ -0,0 +1,35 @@
{% load static %}<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% endblock %}{% block title_suffix %}- Fournée{% endblock %}</title>
{% block css %}
<link rel="stylesheet" href="{% static "main.css" %}">
{% endblock %}
{% block javascript %}
<script>
window.STATIC_URL = '{% get_static_prefix %}';
</script>
<script src="{% static "main.js" %}"></script>
{% endblock %}
{% block extra_head %}{% endblock %}
</head>
<body>
<div class="container">
{% if messages %}
{% for message in messages %}
<div class="alert{% if message.tags %} {{ message.tags }}{% endif %}">{{ message }}</div>
{% endfor %}
{% endif %}
{% block content %}
<p>Utilisez ce modèle pour démarrer rapidement une nouvelle application.</p>
{% endblock %}
</div>
</body>
</html>

View File

@ -0,0 +1,8 @@
{% extends "base.html" %}
{% block title %}Accueil{% endblock %}
{% block content %}
<h1>Bienvenue !</h1>
<p>Cette page ne dira pas grand chose de plus, à vous de la personnaliser.</p>
{% endblock content %}

41
fournée/urls.py Normal file
View File

@ -0,0 +1,41 @@
from django.conf import settings
from django.urls import include, path
#from django.contrib import admin
from django.views.generic import RedirectView
from .core import admin
urlpatterns = [
path("", RedirectView.as_view(url="/admin")),
path("admin/", admin.admin_site.urls),
path("nested_admin/", include("nested_admin.urls")),
]
if settings.DEBUG:
from django.conf.urls.static import static
from django.views import defaults as default_views
# This allows the error pages to be debugged during development, just visit
# these url in browser to see how these error pages look like.
urlpatterns += [
path(
"400/",
default_views.bad_request,
kwargs={"exception": Exception("Bad Request!")},
),
path(
"403/",
default_views.permission_denied,
kwargs={"exception": Exception("Permission Denied")},
),
path(
"404/",
default_views.page_not_found,
kwargs={"exception": Exception("Page not Found")},
),
path("500/", default_views.server_error),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if "debug_toolbar" in settings.INSTALLED_APPS:
urlpatterns.insert(0, path("__debug__/", include("debug_toolbar.urls")))

22
fournée/wsgi.py Normal file
View File

@ -0,0 +1,22 @@
"""
WSGI config for Fournée project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
"""
import os
from django.core.wsgi import get_wsgi_application
from fournée.settings import DJANGO_SETTINGS_MODULE
# Set the default settings module to use.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE)
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
application = get_wsgi_application()

27
manage.py Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python
import os
import sys
from fournée.settings import DJANGO_SETTINGS_MODULE
if __name__ == "__main__":
# Set the default settings module to use.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE)
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django # noqa
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)

392
poetry.lock generated Normal file
View File

@ -0,0 +1,392 @@
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
[[package]]
name = "asgiref"
version = "3.8.1"
description = "ASGI specs, helper code, and adapters"
optional = false
python-versions = ">=3.8"
files = [
{file = "asgiref-3.8.1-py3-none-any.whl", hash = "sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47"},
{file = "asgiref-3.8.1.tar.gz", hash = "sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590"},
]
[package.dependencies]
typing-extensions = {version = ">=4", markers = "python_version < \"3.11\""}
[package.extras]
tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"]
[[package]]
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
[[package]]
name = "coverage"
version = "7.5.0"
description = "Code coverage measurement for Python"
optional = false
python-versions = ">=3.8"
files = [
{file = "coverage-7.5.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:432949a32c3e3f820af808db1833d6d1631664d53dd3ce487aa25d574e18ad1c"},
{file = "coverage-7.5.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2bd7065249703cbeb6d4ce679c734bef0ee69baa7bff9724361ada04a15b7e3b"},
{file = "coverage-7.5.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bbfe6389c5522b99768a93d89aca52ef92310a96b99782973b9d11e80511f932"},
{file = "coverage-7.5.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:39793731182c4be939b4be0cdecde074b833f6171313cf53481f869937129ed3"},
{file = "coverage-7.5.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:85a5dbe1ba1bf38d6c63b6d2c42132d45cbee6d9f0c51b52c59aa4afba057517"},
{file = "coverage-7.5.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:357754dcdfd811462a725e7501a9b4556388e8ecf66e79df6f4b988fa3d0b39a"},
{file = "coverage-7.5.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:a81eb64feded34f40c8986869a2f764f0fe2db58c0530d3a4afbcde50f314880"},
{file = "coverage-7.5.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:51431d0abbed3a868e967f8257c5faf283d41ec882f58413cf295a389bb22e58"},
{file = "coverage-7.5.0-cp310-cp310-win32.whl", hash = "sha256:f609ebcb0242d84b7adeee2b06c11a2ddaec5464d21888b2c8255f5fd6a98ae4"},
{file = "coverage-7.5.0-cp310-cp310-win_amd64.whl", hash = "sha256:6782cd6216fab5a83216cc39f13ebe30adfac2fa72688c5a4d8d180cd52e8f6a"},
{file = "coverage-7.5.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e768d870801f68c74c2b669fc909839660180c366501d4cc4b87efd6b0eee375"},
{file = "coverage-7.5.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:84921b10aeb2dd453247fd10de22907984eaf80901b578a5cf0bb1e279a587cb"},
{file = "coverage-7.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:710c62b6e35a9a766b99b15cdc56d5aeda0914edae8bb467e9c355f75d14ee95"},
{file = "coverage-7.5.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c379cdd3efc0658e652a14112d51a7668f6bfca7445c5a10dee7eabecabba19d"},
{file = "coverage-7.5.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fea9d3ca80bcf17edb2c08a4704259dadac196fe5e9274067e7a20511fad1743"},
{file = "coverage-7.5.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:41327143c5b1d715f5f98a397608f90ab9ebba606ae4e6f3389c2145410c52b1"},
{file = "coverage-7.5.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:565b2e82d0968c977e0b0f7cbf25fd06d78d4856289abc79694c8edcce6eb2de"},
{file = "coverage-7.5.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:cf3539007202ebfe03923128fedfdd245db5860a36810136ad95a564a2fdffff"},
{file = "coverage-7.5.0-cp311-cp311-win32.whl", hash = "sha256:bf0b4b8d9caa8d64df838e0f8dcf68fb570c5733b726d1494b87f3da85db3a2d"},
{file = "coverage-7.5.0-cp311-cp311-win_amd64.whl", hash = "sha256:9c6384cc90e37cfb60435bbbe0488444e54b98700f727f16f64d8bfda0b84656"},
{file = "coverage-7.5.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:fed7a72d54bd52f4aeb6c6e951f363903bd7d70bc1cad64dd1f087980d309ab9"},
{file = "coverage-7.5.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:cbe6581fcff7c8e262eb574244f81f5faaea539e712a058e6707a9d272fe5b64"},
{file = "coverage-7.5.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad97ec0da94b378e593ef532b980c15e377df9b9608c7c6da3506953182398af"},
{file = "coverage-7.5.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bd4bacd62aa2f1a1627352fe68885d6ee694bdaebb16038b6e680f2924a9b2cc"},
{file = "coverage-7.5.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:adf032b6c105881f9d77fa17d9eebe0ad1f9bfb2ad25777811f97c5362aa07f2"},
{file = "coverage-7.5.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:4ba01d9ba112b55bfa4b24808ec431197bb34f09f66f7cb4fd0258ff9d3711b1"},
{file = "coverage-7.5.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:f0bfe42523893c188e9616d853c47685e1c575fe25f737adf473d0405dcfa7eb"},
{file = "coverage-7.5.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a9a7ef30a1b02547c1b23fa9a5564f03c9982fc71eb2ecb7f98c96d7a0db5cf2"},
{file = "coverage-7.5.0-cp312-cp312-win32.whl", hash = "sha256:3c2b77f295edb9fcdb6a250f83e6481c679335ca7e6e4a955e4290350f2d22a4"},
{file = "coverage-7.5.0-cp312-cp312-win_amd64.whl", hash = "sha256:427e1e627b0963ac02d7c8730ca6d935df10280d230508c0ba059505e9233475"},
{file = "coverage-7.5.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9dd88fce54abbdbf4c42fb1fea0e498973d07816f24c0e27a1ecaf91883ce69e"},
{file = "coverage-7.5.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a898c11dca8f8c97b467138004a30133974aacd572818c383596f8d5b2eb04a9"},
{file = "coverage-7.5.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:07dfdd492d645eea1bd70fb1d6febdcf47db178b0d99161d8e4eed18e7f62fe7"},
{file = "coverage-7.5.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d3d117890b6eee85887b1eed41eefe2e598ad6e40523d9f94c4c4b213258e4a4"},
{file = "coverage-7.5.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6afd2e84e7da40fe23ca588379f815fb6dbbb1b757c883935ed11647205111cb"},
{file = "coverage-7.5.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:a9960dd1891b2ddf13a7fe45339cd59ecee3abb6b8326d8b932d0c5da208104f"},
{file = "coverage-7.5.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ced268e82af993d7801a9db2dbc1d2322e786c5dc76295d8e89473d46c6b84d4"},
{file = "coverage-7.5.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e7c211f25777746d468d76f11719e64acb40eed410d81c26cefac641975beb88"},
{file = "coverage-7.5.0-cp38-cp38-win32.whl", hash = "sha256:262fffc1f6c1a26125d5d573e1ec379285a3723363f3bd9c83923c9593a2ac25"},
{file = "coverage-7.5.0-cp38-cp38-win_amd64.whl", hash = "sha256:eed462b4541c540d63ab57b3fc69e7d8c84d5957668854ee4e408b50e92ce26a"},
{file = "coverage-7.5.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d0194d654e360b3e6cc9b774e83235bae6b9b2cac3be09040880bb0e8a88f4a1"},
{file = "coverage-7.5.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:33c020d3322662e74bc507fb11488773a96894aa82a622c35a5a28673c0c26f5"},
{file = "coverage-7.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cbdf2cae14a06827bec50bd58e49249452d211d9caddd8bd80e35b53cb04631"},
{file = "coverage-7.5.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3235d7c781232e525b0761730e052388a01548bd7f67d0067a253887c6e8df46"},
{file = "coverage-7.5.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2de4e546f0ec4b2787d625e0b16b78e99c3e21bc1722b4977c0dddf11ca84e"},
{file = "coverage-7.5.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:4d0e206259b73af35c4ec1319fd04003776e11e859936658cb6ceffdeba0f5be"},
{file = "coverage-7.5.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:2055c4fb9a6ff624253d432aa471a37202cd8f458c033d6d989be4499aed037b"},
{file = "coverage-7.5.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:075299460948cd12722a970c7eae43d25d37989da682997687b34ae6b87c0ef0"},
{file = "coverage-7.5.0-cp39-cp39-win32.whl", hash = "sha256:280132aada3bc2f0fac939a5771db4fbb84f245cb35b94fae4994d4c1f80dae7"},
{file = "coverage-7.5.0-cp39-cp39-win_amd64.whl", hash = "sha256:c58536f6892559e030e6924896a44098bc1290663ea12532c78cef71d0df8493"},
{file = "coverage-7.5.0-pp38.pp39.pp310-none-any.whl", hash = "sha256:2b57780b51084d5223eee7b59f0d4911c31c16ee5aa12737c7a02455829ff067"},
{file = "coverage-7.5.0.tar.gz", hash = "sha256:cf62d17310f34084c59c01e027259076479128d11e4661bb6c9acb38c5e19bb8"},
]
[package.dependencies]
tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""}
[package.extras]
toml = ["tomli"]
[[package]]
name = "django"
version = "4.2.11"
description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design."
optional = false
python-versions = ">=3.8"
files = [
{file = "Django-4.2.11-py3-none-any.whl", hash = "sha256:ddc24a0a8280a0430baa37aff11f28574720af05888c62b7cfe71d219f4599d3"},
{file = "Django-4.2.11.tar.gz", hash = "sha256:6e6ff3db2d8dd0c986b4eec8554c8e4f919b5c1ff62a5b4390c17aff2ed6e5c4"},
]
[package.dependencies]
asgiref = ">=3.6.0,<4"
sqlparse = ">=0.3.1"
tzdata = {version = "*", markers = "sys_platform == \"win32\""}
[package.extras]
argon2 = ["argon2-cffi (>=19.1.0)"]
bcrypt = ["bcrypt"]
[[package]]
name = "django-debug-toolbar"
version = "4.3.0"
description = "A configurable set of panels that display various debug information about the current request/response."
optional = false
python-versions = ">=3.8"
files = [
{file = "django_debug_toolbar-4.3.0-py3-none-any.whl", hash = "sha256:e09b7dcb8417b743234dfc57c95a7c1d1d87a88844abd13b4c5387f807b31bf6"},
{file = "django_debug_toolbar-4.3.0.tar.gz", hash = "sha256:0b0dddee5ea29b9cb678593bc0d7a6d76b21d7799cb68e091a2148341a80f3c4"},
]
[package.dependencies]
django = ">=3.2.4"
sqlparse = ">=0.2"
[[package]]
name = "django-environ"
version = "0.11.2"
description = "A package that allows you to utilize 12factor inspired environment variables to configure your Django application."
optional = false
python-versions = ">=3.6,<4"
files = [
{file = "django-environ-0.11.2.tar.gz", hash = "sha256:f32a87aa0899894c27d4e1776fa6b477e8164ed7f6b3e410a62a6d72caaf64be"},
{file = "django_environ-0.11.2-py2.py3-none-any.whl", hash = "sha256:0ff95ab4344bfeff693836aa978e6840abef2e2f1145adff7735892711590c05"},
]
[package.extras]
develop = ["coverage[toml] (>=5.0a4)", "furo (>=2021.8.17b43,<2021.9.dev0)", "pytest (>=4.6.11)", "sphinx (>=3.5.0)", "sphinx-notfound-page"]
docs = ["furo (>=2021.8.17b43,<2021.9.dev0)", "sphinx (>=3.5.0)", "sphinx-notfound-page"]
testing = ["coverage[toml] (>=5.0a4)", "pytest (>=4.6.11)"]
[[package]]
name = "django-extensions"
version = "3.2.3"
description = "Extensions for Django"
optional = false
python-versions = ">=3.6"
files = [
{file = "django-extensions-3.2.3.tar.gz", hash = "sha256:44d27919d04e23b3f40231c4ab7af4e61ce832ef46d610cc650d53e68328410a"},
{file = "django_extensions-3.2.3-py3-none-any.whl", hash = "sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401"},
]
[package.dependencies]
Django = ">=3.2"
[[package]]
name = "django-nested-admin"
version = "4.0.2"
description = "Django admin classes that allow for nested inlines"
optional = false
python-versions = ">=3.6"
files = [
{file = "django-nested-admin-4.0.2.tar.gz", hash = "sha256:79a5ce80b81c41a0f48f778fb556a3721029df48580bfce60a5962ffa2ef2d47"},
{file = "django_nested_admin-4.0.2-py3-none-any.whl", hash = "sha256:74d8fc0d0f17862ffcece66d39b8814cb649878b3b6ba8438076145a688ea473"},
]
[package.dependencies]
python-monkey-business = ">=1.0.0"
[package.extras]
dev = ["Pillow", "black", "dj-database-url", "django-selenosis", "flake8", "pytest", "pytest-cov", "pytest-django", "pytest-xdist", "selenium"]
test = ["Pillow", "dj-database-url", "django-selenosis", "pytest", "pytest-cov", "pytest-django", "pytest-xdist", "selenium"]
[[package]]
name = "exceptiongroup"
version = "1.2.1"
description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
files = [
{file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"},
{file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"},
]
[package.extras]
test = ["pytest (>=6)"]
[[package]]
name = "iniconfig"
version = "2.0.0"
description = "brain-dead simple config-ini parsing"
optional = false
python-versions = ">=3.7"
files = [
{file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
]
[[package]]
name = "packaging"
version = "24.0"
description = "Core utilities for Python packages"
optional = false
python-versions = ">=3.7"
files = [
{file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"},
{file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"},
]
[[package]]
name = "pluggy"
version = "1.5.0"
description = "plugin and hook calling mechanisms for python"
optional = false
python-versions = ">=3.8"
files = [
{file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"},
{file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"},
]
[package.extras]
dev = ["pre-commit", "tox"]
testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "pytest"
version = "7.4.4"
description = "pytest: simple powerful testing with Python"
optional = false
python-versions = ">=3.7"
files = [
{file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"},
{file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"},
]
[package.dependencies]
colorama = {version = "*", markers = "sys_platform == \"win32\""}
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
iniconfig = "*"
packaging = "*"
pluggy = ">=0.12,<2.0"
tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
[package.extras]
testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
[[package]]
name = "pytest-cov"
version = "4.1.0"
description = "Pytest plugin for measuring coverage."
optional = false
python-versions = ">=3.7"
files = [
{file = "pytest-cov-4.1.0.tar.gz", hash = "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6"},
{file = "pytest_cov-4.1.0-py3-none-any.whl", hash = "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a"},
]
[package.dependencies]
coverage = {version = ">=5.2.1", extras = ["toml"]}
pytest = ">=4.6"
[package.extras]
testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"]
[[package]]
name = "pytest-django"
version = "4.8.0"
description = "A Django plugin for pytest."
optional = false
python-versions = ">=3.8"
files = [
{file = "pytest-django-4.8.0.tar.gz", hash = "sha256:5d054fe011c56f3b10f978f41a8efb2e5adfc7e680ef36fb571ada1f24779d90"},
{file = "pytest_django-4.8.0-py3-none-any.whl", hash = "sha256:ca1ddd1e0e4c227cf9e3e40a6afc6d106b3e70868fd2ac5798a22501271cd0c7"},
]
[package.dependencies]
pytest = ">=7.0.0"
[package.extras]
docs = ["sphinx", "sphinx-rtd-theme"]
testing = ["Django", "django-configurations (>=2.0)"]
[[package]]
name = "python-monkey-business"
version = "1.0.0"
description = "Utility functions for monkey-patching python code"
optional = false
python-versions = "*"
files = [
{file = "python-monkey-business-1.0.0.tar.gz", hash = "sha256:9976522989766f00b2aaa24ec96eacb91a6de7b7001d1452079323b071988e0e"},
{file = "python_monkey_business-1.0.0-py2.py3-none-any.whl", hash = "sha256:6d4cf47f011945db838ccf04643acd49b82f7ad6ab7ecba4c8165385687a828a"},
]
[package.dependencies]
six = ">=1.7.0"
[[package]]
name = "ruff"
version = "0.3.7"
description = "An extremely fast Python linter and code formatter, written in Rust."
optional = false
python-versions = ">=3.7"
files = [
{file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0e8377cccb2f07abd25e84fc5b2cbe48eeb0fea9f1719cad7caedb061d70e5ce"},
{file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:15a4d1cc1e64e556fa0d67bfd388fed416b7f3b26d5d1c3e7d192c897e39ba4b"},
{file = "ruff-0.3.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d28bdf3d7dc71dd46929fafeec98ba89b7c3550c3f0978e36389b5631b793663"},
{file = "ruff-0.3.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:379b67d4f49774ba679593b232dcd90d9e10f04d96e3c8ce4a28037ae473f7bb"},
{file = "ruff-0.3.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c060aea8ad5ef21cdfbbe05475ab5104ce7827b639a78dd55383a6e9895b7c51"},
{file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:ebf8f615dde968272d70502c083ebf963b6781aacd3079081e03b32adfe4d58a"},
{file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d48098bd8f5c38897b03604f5428901b65e3c97d40b3952e38637b5404b739a2"},
{file = "ruff-0.3.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da8a4fda219bf9024692b1bc68c9cff4b80507879ada8769dc7e985755d662ea"},
{file = "ruff-0.3.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c44e0149f1d8b48c4d5c33d88c677a4aa22fd09b1683d6a7ff55b816b5d074f"},
{file = "ruff-0.3.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3050ec0af72b709a62ecc2aca941b9cd479a7bf2b36cc4562f0033d688e44fa1"},
{file = "ruff-0.3.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a29cc38e4c1ab00da18a3f6777f8b50099d73326981bb7d182e54a9a21bb4ff7"},
{file = "ruff-0.3.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5b15cc59c19edca917f51b1956637db47e200b0fc5e6e1878233d3a938384b0b"},
{file = "ruff-0.3.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e491045781b1e38b72c91247cf4634f040f8d0cb3e6d3d64d38dcf43616650b4"},
{file = "ruff-0.3.7-py3-none-win32.whl", hash = "sha256:bc931de87593d64fad3a22e201e55ad76271f1d5bfc44e1a1887edd0903c7d9f"},
{file = "ruff-0.3.7-py3-none-win_amd64.whl", hash = "sha256:5ef0e501e1e39f35e03c2acb1d1238c595b8bb36cf7a170e7c1df1b73da00e74"},
{file = "ruff-0.3.7-py3-none-win_arm64.whl", hash = "sha256:789e144f6dc7019d1f92a812891c645274ed08af6037d11fc65fcbc183b7d59f"},
{file = "ruff-0.3.7.tar.gz", hash = "sha256:d5c1aebee5162c2226784800ae031f660c350e7a3402c4d1f8ea4e97e232e3ba"},
]
[[package]]
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
files = [
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
]
[[package]]
name = "sqlparse"
version = "0.5.0"
description = "A non-validating SQL parser."
optional = false
python-versions = ">=3.8"
files = [
{file = "sqlparse-0.5.0-py3-none-any.whl", hash = "sha256:c204494cd97479d0e39f28c93d46c0b2d5959c7b9ab904762ea6c7af211c8663"},
{file = "sqlparse-0.5.0.tar.gz", hash = "sha256:714d0a4932c059d16189f58ef5411ec2287a4360f17cdd0edd2d09d4c5087c93"},
]
[package.extras]
dev = ["build", "hatch"]
doc = ["sphinx"]
[[package]]
name = "tomli"
version = "2.0.1"
description = "A lil' TOML parser"
optional = false
python-versions = ">=3.7"
files = [
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
]
[[package]]
name = "typing-extensions"
version = "4.11.0"
description = "Backported and Experimental Type Hints for Python 3.8+"
optional = false
python-versions = ">=3.8"
files = [
{file = "typing_extensions-4.11.0-py3-none-any.whl", hash = "sha256:c1f94d72897edaf4ce775bb7558d5b79d8126906a14ea5ed1635921406c0387a"},
{file = "typing_extensions-4.11.0.tar.gz", hash = "sha256:83f085bd5ca59c80295fc2a82ab5dac679cbe02b9f33f7d83af68e241bea51b0"},
]
[[package]]
name = "tzdata"
version = "2024.1"
description = "Provider of IANA time zone data"
optional = false
python-versions = ">=2"
files = [
{file = "tzdata-2024.1-py2.py3-none-any.whl", hash = "sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252"},
{file = "tzdata-2024.1.tar.gz", hash = "sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd"},
]
[metadata]
lock-version = "2.0"
python-versions = "^3.9"
content-hash = "0b954fb9a333b6f89ec33edb81d61c190de7dbd59c0ca2a979ebcb14baaf0dbd"

72
pyproject.toml Normal file
View File

@ -0,0 +1,72 @@
[tool.ruff]
extend-exclude = [
"assets",
"var",
"fournée/migrations/*.py",
]
line-length = 80
[tool.ruff.lint]
# E: pycodestyle errors
# F: Pyflakes
# I: isort
# T20: flake8-print
# BLE: flake8-blind-except
# C4: flake8-comprehensions
select = ["E", "F", "I", "T20", "BLE", "C4"]
[tool.ruff.lint.isort]
known-first-party = ["fournée"]
section-order = [
"future",
"standard-library",
"django",
"third-party",
"first-party",
"local-folder",
]
[tool.ruff.lint.isort.sections]
django = ["django"]
[tool.pytest.ini_options]
testpaths = ["fournée"]
markers = ["wip: mark a test as a work in progress"]
DJANGO_SETTINGS_MODULE = "fournée.settings.test"
[tool.coverage.run]
branch = true
source = ["fournée"]
omit = [
"fournée/migrations/*",
"fournée/settings/*",
"fournée/tests/*",
"fournée/wsgi.py",
]
[tool.coverage.report]
exclude_lines = [
"# pragma: no cover",
"raise NotImplementedError",
]
show_missing = true
[tool.poetry]
package-mode = false
[tool.poetry.dependencies]
python = "^3.9"
django = "~4.2.8"
django-environ = "~0.11.2"
django-nested-admin = "~4.0.2"
[tool.poetry.group.dev]
optional = true
[tool.poetry.group.dev.dependencies]
django-debug-toolbar = "^4.1.0"
django-extensions = "^3.2.3"
pytest = "^7.4.0"
pytest-django = "^4.8.0"
pytest-cov = "^4.1.0"
ruff = "~0.3.7"