pre-commit
This commit is contained in:
parent
0f503847c5
commit
bf76cd227a
18 changed files with 903 additions and 629 deletions
51
.eslintrc
Normal file
51
.eslintrc
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
"jquery": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended"
|
||||
],
|
||||
"ignorePatterns": ["dist/", "node_modules/"],
|
||||
"rules": {
|
||||
"block-scoped-var": "error",
|
||||
"consistent-return": "error",
|
||||
"curly": "error",
|
||||
"default-case": "error",
|
||||
"default-param-last": ["error"],
|
||||
"dot-notation": "error",
|
||||
"eqeqeq": "error",
|
||||
"guard-for-in": "error",
|
||||
"max-classes-per-file": "error",
|
||||
"no-alert": "error",
|
||||
"no-caller": "error",
|
||||
"no-else-return": "error",
|
||||
"no-empty-function": "error",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-param-reassign": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-return-await": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-useless-concat": "error",
|
||||
"radix": ["error", "as-needed"],
|
||||
"require-await": "error",
|
||||
"yoda": "error",
|
||||
"no-shadow": "off",
|
||||
"prefer-destructuring": ["error", { "array": false, "object": true }],
|
||||
"padding-line-between-statements": [
|
||||
"error",
|
||||
{ "blankLine": "always", "prev": "import", "next": "export" },
|
||||
{ "blankLine": "always", "prev": "export", "next": "export" },
|
||||
{ "blankLine": "always", "prev": "*", "next": "return" }
|
||||
]
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
|
@ -1,20 +1,18 @@
|
|||
exclude: \.min\.(js|css)$|/generated/
|
||||
exclude: (\.min\.(js|css)(\.map)?$|/vendor/)
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.4.0
|
||||
rev: v4.1.0
|
||||
hooks:
|
||||
- id: check-ast
|
||||
types: [python]
|
||||
- id: check-json
|
||||
types: [json]
|
||||
- id: check-toml
|
||||
types: [toml]
|
||||
- id: check-xml
|
||||
types: [xml]
|
||||
- id: check-yaml
|
||||
types: [yaml]
|
||||
args: [--allow-multiple-documents]
|
||||
- id: end-of-file-fixer
|
||||
- id: check-merge-conflict
|
||||
- id: debug-statements
|
||||
- id: detect-private-key
|
||||
- id: pretty-format-json
|
||||
args:
|
||||
- --autofix
|
||||
|
@ -23,12 +21,57 @@ repos:
|
|||
args:
|
||||
- --markdown-linebreak-ext=md
|
||||
- repo: https://github.com/timothycrosley/isort
|
||||
rev: 5.8.0
|
||||
rev: 5.10.1
|
||||
hooks:
|
||||
- id: isort
|
||||
types: [python]
|
||||
args:
|
||||
- --profile=black
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 20.8b1
|
||||
rev: 22.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
types: [python]
|
||||
- id: black
|
||||
args:
|
||||
- --target-version=py310
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.31.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args:
|
||||
- --py310-plus
|
||||
- repo: https://github.com/adamchainz/django-upgrade
|
||||
rev: 1.4.0
|
||||
hooks:
|
||||
- id: django-upgrade
|
||||
args: [--target-version, "4.0"]
|
||||
- repo: https://github.com/rtts/djhtml
|
||||
rev: v1.5.0
|
||||
hooks:
|
||||
- id: djhtml
|
||||
- repo: https://github.com/flakeheaven/flakeheaven
|
||||
rev: 0.11.0
|
||||
hooks:
|
||||
- id: flakeheaven
|
||||
additional_dependencies:
|
||||
- flake8-annotations-complexity
|
||||
- flake8-builtins
|
||||
- flake8-bugbear
|
||||
- flake8-comprehensions
|
||||
- flake8-eradicate
|
||||
- flake8-noqa
|
||||
- flake8-pytest-style
|
||||
- flake8-pyi
|
||||
- wemake-python-styleguide
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v2.5.1
|
||||
hooks:
|
||||
- id: prettier
|
||||
types_or: [javascript, css]
|
||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||
rev: v8.9.0
|
||||
hooks:
|
||||
- id: eslint
|
||||
args: [--fix]
|
||||
types_or: [javascript, css]
|
||||
additional_dependencies:
|
||||
- eslint@^7.29.0
|
||||
- eslint-config-prettier@^8.3.0
|
||||
|
|
5
.prettierrc
Normal file
5
.prettierrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"tabWidth": 4,
|
||||
"printWidth": 120,
|
||||
"endOfLine": "auto"
|
||||
}
|
1
LICENSE
1
LICENSE
|
@ -22,4 +22,3 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <https://unlicense.org>
|
||||
|
||||
|
|
|
@ -21,4 +21,4 @@ You may need to upgrade Python since Heroku tends to deprecate old patch version
|
|||
In this case, edit `runtime.txt`.
|
||||
|
||||
# Reuse
|
||||
If you do reuse my work, please consider linking back to this repository 🙂
|
||||
If you do reuse my work, please consider linking back to this repository 🙂
|
||||
|
|
|
@ -93,7 +93,7 @@ class LevelAdmin(ExportMixin, admin.ModelAdmin):
|
|||
|
||||
def get_queryset(self, request):
|
||||
return (
|
||||
super(LevelAdmin, self)
|
||||
super()
|
||||
.get_queryset(request)
|
||||
.prefetch_related(Prefetch("book_set", to_attr="prefetched_books"))
|
||||
)
|
||||
|
@ -230,9 +230,7 @@ class BookAdmin(ExportMixin, admin.ModelAdmin):
|
|||
|
||||
def get_queryset(self, request):
|
||||
return (
|
||||
super(BookAdmin, self)
|
||||
.get_queryset(request)
|
||||
.select_related("editor", "level", "teacher")
|
||||
super().get_queryset(request).select_related("editor", "level", "teacher")
|
||||
)
|
||||
|
||||
def update_with_decitre(self, request, queryset):
|
||||
|
@ -298,8 +296,4 @@ class SuppliesRequirementAdmin(ExportMixin, admin.ModelAdmin):
|
|||
list_filter = ["done", "teacher", "level"]
|
||||
|
||||
def get_queryset(self, request):
|
||||
return (
|
||||
super(SuppliesRequirementAdmin, self)
|
||||
.get_queryset(request)
|
||||
.select_related("level", "teacher")
|
||||
)
|
||||
return super().get_queryset(request).select_related("level", "teacher")
|
||||
|
|
|
@ -1,104 +1,108 @@
|
|||
document.addEventListener("DOMContentLoaded", function (event) {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
var isbnButton = document.querySelector('#id_isbn_button');
|
||||
var isbn = document.querySelector('#id_isbn');
|
||||
var title = document.querySelector('#id_title');
|
||||
var authors = document.querySelector('#id_authors');
|
||||
var year = document.querySelector('#id_publication_year');
|
||||
var price = document.querySelector('#id_price');
|
||||
var editor = document.querySelector('#id_editor');
|
||||
var otherEditor = document.querySelector('#id_other_editor');
|
||||
var spinner = document.querySelector('#id_isbn_spinner');
|
||||
var feedback = document.querySelector('#id_isbn_invalid_feedback');
|
||||
var isbnButton = document.querySelector("#id_isbn_button");
|
||||
var isbn = document.querySelector("#id_isbn");
|
||||
var title = document.querySelector("#id_title");
|
||||
var authors = document.querySelector("#id_authors");
|
||||
var year = document.querySelector("#id_publication_year");
|
||||
var price = document.querySelector("#id_price");
|
||||
var editor = document.querySelector("#id_editor");
|
||||
var otherEditor = document.querySelector("#id_other_editor");
|
||||
var spinner = document.querySelector("#id_isbn_spinner");
|
||||
var feedback = document.querySelector("#id_isbn_invalid_feedback");
|
||||
|
||||
function enableFields() {
|
||||
isbn.removeAttribute('disabled');
|
||||
isbnButton.removeAttribute('disabled');
|
||||
document.querySelector('#id_title').removeAttribute('disabled');
|
||||
authors.removeAttribute('disabled');
|
||||
year.removeAttribute('disabled');
|
||||
price.removeAttribute('disabled');
|
||||
editor.removeAttribute('disabled');
|
||||
otherEditor.removeAttribute('disabled');
|
||||
spinner.setAttribute('hidden', 'hidden');
|
||||
isbn.removeAttribute("disabled");
|
||||
isbnButton.removeAttribute("disabled");
|
||||
document.querySelector("#id_title").removeAttribute("disabled");
|
||||
authors.removeAttribute("disabled");
|
||||
year.removeAttribute("disabled");
|
||||
price.removeAttribute("disabled");
|
||||
editor.removeAttribute("disabled");
|
||||
otherEditor.removeAttribute("disabled");
|
||||
spinner.setAttribute("hidden", "hidden");
|
||||
}
|
||||
|
||||
function disableFields() {
|
||||
isbn.setAttribute('disabled', 'disabled');
|
||||
isbnButton.setAttribute('disabled', 'disabled');
|
||||
title.setAttribute('disabled', 'disabled');
|
||||
authors.setAttribute('disabled', 'disabled');
|
||||
year.setAttribute('disabled', 'disabled');
|
||||
price.setAttribute('disabled', 'disabled');
|
||||
editor.setAttribute('disabled', 'disabled');
|
||||
otherEditor.setAttribute('disabled', 'disabled');
|
||||
spinner.removeAttribute('hidden');
|
||||
isbn.setAttribute("disabled", "disabled");
|
||||
isbnButton.setAttribute("disabled", "disabled");
|
||||
title.setAttribute("disabled", "disabled");
|
||||
authors.setAttribute("disabled", "disabled");
|
||||
year.setAttribute("disabled", "disabled");
|
||||
price.setAttribute("disabled", "disabled");
|
||||
editor.setAttribute("disabled", "disabled");
|
||||
otherEditor.setAttribute("disabled", "disabled");
|
||||
spinner.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
isbnButton.addEventListener('click', function (event) {
|
||||
isbnButton.addEventListener("click", function () {
|
||||
if (!isbn.value) {
|
||||
return;
|
||||
}
|
||||
disableFields();
|
||||
|
||||
fetch("/isbn_api/" + isbn.value).then(function (data) {
|
||||
if (!data.ok) {
|
||||
throw Error("Erreur dans la récupération des données");
|
||||
}
|
||||
return data.json();
|
||||
}).then(function (data) {
|
||||
isbn.classList.remove('is-invalid');
|
||||
isbn.classList.add('is-valid');
|
||||
feedback.style.display = 'none';
|
||||
feedback.textContent = '';
|
||||
fetch("/isbn_api/" + isbn.value)
|
||||
.then(function (data) {
|
||||
if (!data.ok) {
|
||||
throw Error("Erreur dans la récupération des données");
|
||||
}
|
||||
|
||||
title.value = data.title;
|
||||
title.classList.add('is-valid');
|
||||
authors.value = data.authors;
|
||||
authors.classList.add('is-valid');
|
||||
year.value = data.year;
|
||||
year.classList.add('is-valid');
|
||||
price.value = data.price;
|
||||
price.classList.add('is-valid');
|
||||
return data.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
isbn.classList.remove("is-invalid");
|
||||
isbn.classList.add("is-valid");
|
||||
feedback.style.display = "none";
|
||||
feedback.textContent = "";
|
||||
|
||||
var editorValue = "";
|
||||
var editorIsOther = false;
|
||||
if (data.editor) {
|
||||
for (var option of document.querySelector('#id_editor').children) {
|
||||
if (editorValue === "" && option.firstChild.data.toLowerCase().indexOf('autre') !== -1) {
|
||||
editorValue = option.value;
|
||||
editorIsOther = true;
|
||||
}
|
||||
if (option.firstChild.data.toLowerCase() === data.editor.toLowerCase()) {
|
||||
editorValue = option.value;
|
||||
editorIsOther = false;
|
||||
title.value = data.title;
|
||||
title.classList.add("is-valid");
|
||||
authors.value = data.authors;
|
||||
authors.classList.add("is-valid");
|
||||
year.value = data.year;
|
||||
year.classList.add("is-valid");
|
||||
price.value = data.price;
|
||||
price.classList.add("is-valid");
|
||||
|
||||
var editorValue = "";
|
||||
var editorIsOther = false;
|
||||
if (data.editor) {
|
||||
for (var option of document.querySelector("#id_editor").children) {
|
||||
if (editorValue === "" && option.firstChild.data.toLowerCase().indexOf("autre") !== -1) {
|
||||
editorValue = option.value;
|
||||
editorIsOther = true;
|
||||
}
|
||||
if (option.firstChild.data.toLowerCase() === data.editor.toLowerCase()) {
|
||||
editorValue = option.value;
|
||||
editorIsOther = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
editor.value = editorValue;
|
||||
editor.classList.add('is-valid');
|
||||
editor.value = editorValue;
|
||||
editor.classList.add("is-valid");
|
||||
|
||||
if (editorIsOther) {
|
||||
otherEditor.value = data.editor;
|
||||
otherEditor.classList.add('is-valid');
|
||||
}
|
||||
enableFields();
|
||||
if (editorIsOther) {
|
||||
otherEditor.value = data.editor;
|
||||
otherEditor.classList.add("is-valid");
|
||||
}
|
||||
enableFields();
|
||||
|
||||
// The event propagation must be done after the fields have been re-enabled
|
||||
// because a change event can't be propagated to a field that's disabled.
|
||||
var event = document.createEvent("HTMLEvents");
|
||||
event.initEvent("change", true, true);
|
||||
event.eventName = "change";
|
||||
document.querySelector('#id_editor').dispatchEvent(event);
|
||||
}).catch(function(error) {
|
||||
isbn.classList.add('is-invalid');
|
||||
isbn.classList.remove('is-valid');
|
||||
feedback.style.display = 'block';
|
||||
feedback.textContent = error;
|
||||
enableFields();
|
||||
});
|
||||
// The event propagation must be done after the fields have been re-enabled
|
||||
// because a change event can't be propagated to a field that's disabled.
|
||||
var event = document.createEvent("HTMLEvents");
|
||||
event.initEvent("change", true, true);
|
||||
event.eventName = "change";
|
||||
document.querySelector("#id_editor").dispatchEvent(event);
|
||||
})
|
||||
.catch(function (error) {
|
||||
isbn.classList.add("is-invalid");
|
||||
isbn.classList.remove("is-valid");
|
||||
feedback.style.display = "block";
|
||||
feedback.textContent = error;
|
||||
enableFields();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,79 +1,78 @@
|
|||
document.addEventListener("DOMContentLoaded", function (event) {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var selectors = [
|
||||
{
|
||||
id: "#id_no_book",
|
||||
value: "PAS DE LIVRE POUR CETTE CLASSE"
|
||||
value: "PAS DE LIVRE POUR CETTE CLASSE",
|
||||
},
|
||||
{
|
||||
id: "#id_see_later",
|
||||
value: "VOIR À LA RENTRÉE"
|
||||
value: "VOIR À LA RENTRÉE",
|
||||
},
|
||||
];
|
||||
selectors.forEach(function (selector, index, array) {
|
||||
selectors.forEach(function (selector) {
|
||||
var _selector = document.querySelector(selector.id);
|
||||
if (_selector === null) return;
|
||||
if (_selector === null) {
|
||||
return;
|
||||
}
|
||||
var data = {
|
||||
title: document.querySelector('#id_title').value,
|
||||
authors: document.querySelector('#id_authors').value,
|
||||
publicationYear: document.querySelector('#id_publication_year').value,
|
||||
isbn: document.querySelector('#id_isbn').value,
|
||||
price: document.querySelector('#id_price').value,
|
||||
editor: document.querySelector('#id_editor').value,
|
||||
previouslyAcquired: document.querySelector('#id_previously_acquired').value,
|
||||
title: document.querySelector("#id_title").value,
|
||||
authors: document.querySelector("#id_authors").value,
|
||||
publicationYear: document.querySelector("#id_publication_year").value,
|
||||
isbn: document.querySelector("#id_isbn").value,
|
||||
price: document.querySelector("#id_price").value,
|
||||
editor: document.querySelector("#id_editor").value,
|
||||
previouslyAcquired: document.querySelector("#id_previously_acquired").value,
|
||||
};
|
||||
_selector.addEventListener('change', function (event) {
|
||||
_selector.addEventListener("change", function () {
|
||||
if (_selector.checked) {
|
||||
data = {
|
||||
title: document.querySelector('#id_title').value,
|
||||
authors: document.querySelector('#id_authors').value,
|
||||
publicationYear: document.querySelector('#id_publication_year').value,
|
||||
isbn: document.querySelector('#id_isbn').value,
|
||||
price: document.querySelector('#id_price').value,
|
||||
editor: document.querySelector('#id_editor').value,
|
||||
previouslyAcquired: document.querySelector('#id_previously_acquired').value,
|
||||
title: document.querySelector("#id_title").value,
|
||||
authors: document.querySelector("#id_authors").value,
|
||||
publicationYear: document.querySelector("#id_publication_year").value,
|
||||
isbn: document.querySelector("#id_isbn").value,
|
||||
price: document.querySelector("#id_price").value,
|
||||
editor: document.querySelector("#id_editor").value,
|
||||
previouslyAcquired: document.querySelector("#id_previously_acquired").value,
|
||||
};
|
||||
document.querySelector('#id_title').value = selector.value;
|
||||
document.querySelector('#id_authors').value = "N/A";
|
||||
document.querySelector('#id_publication_year').value = 1900;
|
||||
document.querySelector('#id_isbn').value = "0000000000";
|
||||
document.querySelector('#id_price').value = 0;
|
||||
document.querySelector('#id_previously_acquired').value = "False";
|
||||
document.querySelector("#id_title").value = selector.value;
|
||||
document.querySelector("#id_authors").value = "N/A";
|
||||
document.querySelector("#id_publication_year").value = 1900;
|
||||
document.querySelector("#id_isbn").value = "0000000000";
|
||||
document.querySelector("#id_price").value = 0;
|
||||
document.querySelector("#id_previously_acquired").value = "False";
|
||||
var editorValue = null;
|
||||
for (var option of document.querySelector('#id_editor').children) {
|
||||
for (var option of document.querySelector("#id_editor").children) {
|
||||
if (editorValue === null && option.value !== "") {
|
||||
editorValue = option.value;
|
||||
}
|
||||
if (option.firstChild.data.toLowerCase().indexOf('autre') !== -1) {
|
||||
if (option.firstChild.data.toLowerCase().indexOf("autre") !== -1) {
|
||||
editorValue = option.value;
|
||||
}
|
||||
}
|
||||
document.querySelector('#id_editor').value = editorValue;
|
||||
document.querySelector("#id_editor").value = editorValue;
|
||||
} else {
|
||||
document.querySelector('#id_title').value = data.title;
|
||||
document.querySelector('#id_authors').value = data.authors;
|
||||
document.querySelector('#id_editor').value = data.editor;
|
||||
document.querySelector('#id_publication_year').value = data.publicationYear;
|
||||
document.querySelector('#id_isbn').value = data.isbn;
|
||||
document.querySelector('#id_price').value = data.price;
|
||||
document.querySelector('#id_previously_acquired').value = data.previouslyAcquired;
|
||||
document.querySelector("#id_title").value = data.title;
|
||||
document.querySelector("#id_authors").value = data.authors;
|
||||
document.querySelector("#id_editor").value = data.editor;
|
||||
document.querySelector("#id_publication_year").value = data.publicationYear;
|
||||
document.querySelector("#id_isbn").value = data.isbn;
|
||||
document.querySelector("#id_price").value = data.price;
|
||||
document.querySelector("#id_previously_acquired").value = data.previouslyAcquired;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function toggleOtherEditorDisplay() {
|
||||
var editor = document.querySelector('#id_editor');
|
||||
var otherEditor = document.querySelector('#id_other_editor').parentElement;
|
||||
var editor = document.querySelector("#id_editor");
|
||||
var otherEditor = document.querySelector("#id_other_editor").parentElement;
|
||||
|
||||
if (editor.options[editor.selectedIndex].text.toLowerCase().indexOf('autre') !== -1) {
|
||||
otherEditor.style.display = 'block';
|
||||
}
|
||||
else {
|
||||
otherEditor.style.display = 'none';
|
||||
if (editor.options[editor.selectedIndex].text.toLowerCase().indexOf("autre") !== -1) {
|
||||
otherEditor.style.display = "block";
|
||||
} else {
|
||||
otherEditor.style.display = "none";
|
||||
}
|
||||
}
|
||||
toggleOtherEditorDisplay();
|
||||
|
||||
document.querySelector('#id_editor').addEventListener('change', toggleOtherEditorDisplay);
|
||||
|
||||
document.querySelector("#id_editor").addEventListener("change", toggleOtherEditorDisplay);
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
Vous avez peut-être déjà rencontré ce type d'erreur (peut-être même sur ce site) sans
|
||||
forcément comprendre ce qu'il signifie.
|
||||
Voici donc un extrait de <a href="https://fr.wikipedia.org/wiki/Erreur_HTTP_404">la page Wikipedia
|
||||
traitant spécifiquement de l'erreur 404</a> <i class="fas fa-book-reader"></i>
|
||||
traitant spécifiquement de l'erreur 404</a> <i class="fas fa-book-reader"></i>
|
||||
</p>
|
||||
|
||||
<blockquote class="blockquote text-right">
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="{{ form.see_later.auto_id }}">
|
||||
<label class="custom-control-label"
|
||||
for="{{ form.see_later.auto_id }}">{{ form.see_later.label }}</label>
|
||||
for="{{ form.see_later.auto_id }}">{{ form.see_later.label }}</label>
|
||||
<small class="form-text text-muted">
|
||||
{{ form.see_later.help_text|safe }}
|
||||
</small>
|
||||
|
@ -44,10 +44,10 @@
|
|||
{% bootstrap_label content=form.isbn.label label_for=form.isbn.auto_id %}
|
||||
<div class="input-group">
|
||||
<input name="{{ form.isbn.name }}" maxlength="20"
|
||||
class="form-control"
|
||||
placeholder="{{ form.isbn.label }}"
|
||||
{% if form.isbn.value != None %} value="{{ form.isbn.value|stringformat:'s' }}"{% endif %}
|
||||
required="" id="{{ form.isbn.auto_id }}" type="text">
|
||||
class="form-control"
|
||||
placeholder="{{ form.isbn.label }}"
|
||||
{% if form.isbn.value != None %} value="{{ form.isbn.value|stringformat:'s' }}"{% endif %}
|
||||
required="" id="{{ form.isbn.auto_id }}" type="text">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button" id="id_isbn_button" data-toggle="tooltip" data-placement="top" title="Chercher avec Decitre">
|
||||
<i class="fas fa-search"></i> <i class="fas fa-spinner fa-spin" id="id_isbn_spinner" hidden></i>
|
||||
|
@ -95,11 +95,11 @@
|
|||
<div class="col-12">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input"
|
||||
{% if form.add_another.initial %}checked="checked"{% endif %}
|
||||
name="{{ form.add_another.name }}"
|
||||
id="{{ form.add_another.auto_id }}">
|
||||
{% if form.add_another.initial %}checked="checked"{% endif %}
|
||||
name="{{ form.add_another.name }}"
|
||||
id="{{ form.add_another.auto_id }}">
|
||||
<label class="custom-control-label"
|
||||
for="{{ form.add_another.auto_id }}">{{ form.add_another.label }}</label>
|
||||
for="{{ form.add_another.auto_id }}">{{ form.add_another.label }}</label>
|
||||
<small class="form-text text-muted">
|
||||
{{ form.add_another.help_text|safe }}
|
||||
</small>
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
<div class="col-12">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input"
|
||||
{% if form.add_another.initial %}checked="checked"{% endif %}
|
||||
name="{{ form.add_another.name }}"
|
||||
id="{{ form.add_another.auto_id }}">
|
||||
{% if form.add_another.initial %}checked="checked"{% endif %}
|
||||
name="{{ form.add_another.name }}"
|
||||
id="{{ form.add_another.auto_id }}">
|
||||
<label class="custom-control-label"
|
||||
for="{{ form.add_another.auto_id }}">{{ form.add_another.label }}</label>
|
||||
for="{{ form.add_another.auto_id }}">{{ form.add_another.label }}</label>
|
||||
<small class="form-text text-muted">
|
||||
{{ form.add_another.help_text|safe }}
|
||||
</small>
|
||||
|
|
|
@ -2,87 +2,87 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Manuels - {% block title %}{% endblock %}</title>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Manuels - {% block title %}{% endblock %}</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180"
|
||||
href="{% static 'icons/apple-touch-icon.png' %}">
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="{% static 'icons/favicon-32x32.png' %}">
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{% static 'icons/favicon-16x16.png' %}">
|
||||
<link rel="manifest" href="{% static 'icons/site.webmanifest' %}">
|
||||
<link rel="mask-icon" href="{% static 'icons/safari-pinned-tab.svg' %}"
|
||||
color="#000000">
|
||||
<link rel="shortcut icon" href="{% static 'icons/favicon.ico' %}">
|
||||
<meta name="msapplication-TileColor" content="#2d89ef">
|
||||
<meta name="msapplication-config"
|
||||
content="{% static 'icons/browserconfig.xml' %}">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l"
|
||||
crossorigin="anonymous">
|
||||
<link rel="apple-touch-icon" sizes="180x180"
|
||||
href="{% static 'icons/apple-touch-icon.png' %}">
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="{% static 'icons/favicon-32x32.png' %}">
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{% static 'icons/favicon-16x16.png' %}">
|
||||
<link rel="manifest" href="{% static 'icons/site.webmanifest' %}">
|
||||
<link rel="mask-icon" href="{% static 'icons/safari-pinned-tab.svg' %}"
|
||||
color="#000000">
|
||||
<link rel="shortcut icon" href="{% static 'icons/favicon.ico' %}">
|
||||
<meta name="msapplication-TileColor" content="#2d89ef">
|
||||
<meta name="msapplication-config"
|
||||
content="{% static 'icons/browserconfig.xml' %}">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l"
|
||||
crossorigin="anonymous">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="d-flex flex-column min-vh-100">
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<a class="navbar-brand" href="{% url 'home_page' %}">Manuels scolaires</a>
|
||||
{% if user.is_authenticated or teacher and teacher.email in authorized_mails %}
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'admin:index' %}">
|
||||
<i class="fas fa-door-open"></i>
|
||||
Administration
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</nav>
|
||||
<main class="flex-fill">
|
||||
<div class="container-fluid">
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{{ message.tags }} fade show" role="alert">
|
||||
{{ message }}
|
||||
</head>
|
||||
<body>
|
||||
<div class="d-flex flex-column min-vh-100">
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<a class="navbar-brand" href="{% url 'home_page' %}">Manuels scolaires</a>
|
||||
{% if user.is_authenticated or teacher and teacher.email in authorized_mails %}
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'admin:index' %}">
|
||||
<i class="fas fa-door-open"></i>
|
||||
Administration
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</nav>
|
||||
<main class="flex-fill">
|
||||
<div class="container-fluid">
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{{ message.tags }} fade show" role="alert">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer class="bg-light py-3">
|
||||
<div class="container-fluid">
|
||||
<span class="text-muted">Ce service est un logiciel libre sous licence MIT réalisé par
|
||||
Gabriel Augendre d'après des besoins exprimés par Sandrine Augendre. Le code source est disponible
|
||||
<a href="https://git.augendre.info/gaugendre/manuels-scolaires">à cette adresse</a>.</span>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="bg-light py-3">
|
||||
<div class="container-fluid">
|
||||
<span class="text-muted">Ce service est un logiciel libre sous licence MIT réalisé par
|
||||
Gabriel Augendre d'après des besoins exprimés par Sandrine Augendre. Le code source est disponible
|
||||
<a href="https://git.augendre.info/gaugendre/manuels-scolaires">à cette adresse</a>.</span>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script defer src="https://kit.fontawesome.com/350c07ee78.js"
|
||||
integrity="sha384-IwFbZvLB3nqmwJikzn6JZAqNDTwjFfauT4djixzjaxmR030Fd2gx05kWWwBLwRYZ"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
|
||||
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
<script defer src="https://kit.fontawesome.com/350c07ee78.js"
|
||||
integrity="sha384-IwFbZvLB3nqmwJikzn6JZAqNDTwjFfauT4djixzjaxmR030Fd2gx05kWWwBLwRYZ"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
|
||||
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
{% block end_js %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
{% block end_js %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<h4 class="alert-heading"><i class="fas fa-exclamation-circle"></i> Danger</h4>
|
||||
<p class="mb-0">
|
||||
Êtes-vous <strong>certain·e</strong> de vouloir confirmer vos listes de manuels et de fournitures ?
|
||||
Cette action est <u><strong>définitive</strong></u> : vous ne ne serez plus en mesure de les modifier ensuite.
|
||||
Cette action est <u><strong>définitive</strong></u> : vous ne ne serez plus en mesure de les modifier ensuite.
|
||||
</p>
|
||||
</div>
|
||||
<form action="" method="post" class="form">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<html>
|
||||
<p>Bonjour,</p>
|
||||
<p>
|
||||
{{ teacher.full_name }} a confirmé ses listes sur <a href="{{ link }}">{{ link }}</a>
|
||||
</p>
|
||||
<p>Bonjour,</p>
|
||||
<p>
|
||||
{{ teacher.full_name }} a confirmé ses listes sur <a href="{{ link }}">{{ link }}</a>
|
||||
</p>
|
||||
</html>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<html>
|
||||
<p>Bonjour {{ teacher.first_name }},</p>
|
||||
<p>
|
||||
Voici votre lien pour la gestion des manuels scolaires :
|
||||
</p>
|
||||
<p>Bonjour {{ teacher.first_name }},</p>
|
||||
<p>
|
||||
Voici votre lien pour la gestion des manuels scolaires :
|
||||
</p>
|
||||
|
||||
<p style="text-align: center;">
|
||||
<a href="{{ link }}">{{ link }}</a>
|
||||
</p>
|
||||
<p style="text-align: center;">
|
||||
<a href="{{ link }}">{{ link }}</a>
|
||||
</p>
|
||||
</html>
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
Liste des livres demandés
|
||||
{% if not teacher.has_confirmed_list %}
|
||||
<a href="{% url 'add_book' pk=teacher.pk %}"
|
||||
class="btn btn-primary"
|
||||
id="add-book">
|
||||
class="btn btn-primary"
|
||||
id="add-book">
|
||||
<i class="fas fa-plus-circle"></i> Ajouter un livre
|
||||
</a>
|
||||
{% endif %}
|
||||
|
@ -43,57 +43,57 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
{% if not teacher.has_confirmed_list %}
|
||||
<th scope="col">Modifier</th>
|
||||
{% endif %}
|
||||
<th scope="col">Classe</th>
|
||||
<th scope="col">Discipline</th>
|
||||
<th scope="col">Titre</th>
|
||||
<th scope="col">Auteurs</th>
|
||||
<th scope="col">Éditeur</th>
|
||||
<th scope="col">Année de publication</th>
|
||||
<th scope="col">ISBN</th>
|
||||
<th scope="col">Prix</th>
|
||||
<th scope="col">Déjà acheté par l'élève</th>
|
||||
<th scope="col">Consommable</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for book in teacher.book_set.all %}
|
||||
<tr>
|
||||
{% if not teacher.has_confirmed_list %}
|
||||
<th scope="row">
|
||||
<div class="btn-group">
|
||||
<a title="Modifier"
|
||||
href="{% url 'edit_book' teacher_pk=book.teacher.pk pk=book.pk %}"
|
||||
class="btn btn-sm btn-secondary"><i class="fas fa-edit"></i></a>
|
||||
<a title="Supprimer"
|
||||
href="{% url 'delete_book' teacher_pk=book.teacher.pk pk=book.pk %}"
|
||||
class="btn btn-sm btn-danger"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col">Modifier</th>
|
||||
{% endif %}
|
||||
<td>{{ book.level }}</td>
|
||||
<td>{{ book.field }}</td>
|
||||
<td>{{ book.title }}</td>
|
||||
<td>{{ book.authors }}</td>
|
||||
<td>{{ book.editor }}{% if book.other_editor %}
|
||||
({{ book.other_editor }})
|
||||
{% endif %}</td>
|
||||
<td>{{ book.publication_year }}</td>
|
||||
<td>{{ book.isbn }}</td>
|
||||
<td>{{ book.price }}€</td>
|
||||
<td>
|
||||
<i class="fas fa-{% if book.previously_acquired %}check-circle{% else %}ban{% endif %}"></i>
|
||||
{{ book.previously_acquired_text }}
|
||||
</td>
|
||||
<td>
|
||||
<i class="fas fa-{% if book.consumable %}check-circle{% else %}ban{% endif %}"></i>
|
||||
{{ book.consumable_text }}
|
||||
</td>
|
||||
<th scope="col">Classe</th>
|
||||
<th scope="col">Discipline</th>
|
||||
<th scope="col">Titre</th>
|
||||
<th scope="col">Auteurs</th>
|
||||
<th scope="col">Éditeur</th>
|
||||
<th scope="col">Année de publication</th>
|
||||
<th scope="col">ISBN</th>
|
||||
<th scope="col">Prix</th>
|
||||
<th scope="col">Déjà acheté par l'élève</th>
|
||||
<th scope="col">Consommable</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for book in teacher.book_set.all %}
|
||||
<tr>
|
||||
{% if not teacher.has_confirmed_list %}
|
||||
<th scope="row">
|
||||
<div class="btn-group">
|
||||
<a title="Modifier"
|
||||
href="{% url 'edit_book' teacher_pk=book.teacher.pk pk=book.pk %}"
|
||||
class="btn btn-sm btn-secondary"><i class="fas fa-edit"></i></a>
|
||||
<a title="Supprimer"
|
||||
href="{% url 'delete_book' teacher_pk=book.teacher.pk pk=book.pk %}"
|
||||
class="btn btn-sm btn-danger"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</th>
|
||||
{% endif %}
|
||||
<td>{{ book.level }}</td>
|
||||
<td>{{ book.field }}</td>
|
||||
<td>{{ book.title }}</td>
|
||||
<td>{{ book.authors }}</td>
|
||||
<td>{{ book.editor }}{% if book.other_editor %}
|
||||
({{ book.other_editor }})
|
||||
{% endif %}</td>
|
||||
<td>{{ book.publication_year }}</td>
|
||||
<td>{{ book.isbn }}</td>
|
||||
<td>{{ book.price }}€</td>
|
||||
<td>
|
||||
<i class="fas fa-{% if book.previously_acquired %}check-circle{% else %}ban{% endif %}"></i>
|
||||
{{ book.previously_acquired_text }}
|
||||
</td>
|
||||
<td>
|
||||
<i class="fas fa-{% if book.consumable %}check-circle{% else %}ban{% endif %}"></i>
|
||||
{{ book.consumable_text }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -112,35 +112,35 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
{% if not teacher.has_confirmed_list %}
|
||||
<th scope="col">Modifier</th>
|
||||
{% endif %}
|
||||
<th scope="col">Classe</th>
|
||||
<th scope="col">Discipline</th>
|
||||
<th scope="col">Liste de fournitures</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for supply in teacher.suppliesrequirement_set.all %}
|
||||
<tr>
|
||||
{% if not teacher.has_confirmed_list %}
|
||||
<th scope="row">
|
||||
<div class="btn-group">
|
||||
<a title="Modifier"
|
||||
href="{% url 'edit_supplies' teacher_pk=supply.teacher.pk pk=supply.pk %}"
|
||||
class="btn btn-sm btn-secondary"><i class="fas fa-edit"></i></a>
|
||||
<a title="Supprimer"
|
||||
href="{% url 'delete_supplies' teacher_pk=supply.teacher.pk pk=supply.pk %}"
|
||||
class="btn btn-sm btn-danger"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col">Modifier</th>
|
||||
{% endif %}
|
||||
<td>{{ supply.level }}</td>
|
||||
<td>{{ supply.field }}</td>
|
||||
<td>{{ supply.supplies|linebreaksbr }}</td>
|
||||
<th scope="col">Classe</th>
|
||||
<th scope="col">Discipline</th>
|
||||
<th scope="col">Liste de fournitures</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for supply in teacher.suppliesrequirement_set.all %}
|
||||
<tr>
|
||||
{% if not teacher.has_confirmed_list %}
|
||||
<th scope="row">
|
||||
<div class="btn-group">
|
||||
<a title="Modifier"
|
||||
href="{% url 'edit_supplies' teacher_pk=supply.teacher.pk pk=supply.pk %}"
|
||||
class="btn btn-sm btn-secondary"><i class="fas fa-edit"></i></a>
|
||||
<a title="Supprimer"
|
||||
href="{% url 'delete_supplies' teacher_pk=supply.teacher.pk pk=supply.pk %}"
|
||||
class="btn btn-sm btn-danger"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</th>
|
||||
{% endif %}
|
||||
<td>{{ supply.level }}</td>
|
||||
<td>{{ supply.field }}</td>
|
||||
<td>{{ supply.supplies|linebreaksbr }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
777
poetry.lock
generated
777
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@ authors = ["Gabriel Augendre <gabriel@augendre.info>"]
|
|||
license = "MIT"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
python = "^3.10"
|
||||
Django = "^3.2.4"
|
||||
django-bootstrap4 = "^3.0.1"
|
||||
gunicorn = "^20.1.0"
|
||||
|
@ -32,12 +32,6 @@ vcrpy = "^4.1.1"
|
|||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.black]
|
||||
target-version = ['py38']
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "--html=pytest_result/pytest.html --color=yes"
|
||||
minversion = "6.0"
|
||||
|
|
Loading…
Reference in a new issue