Browse Source

Run pre-commit

master
Gabriel Augendre 3 months ago
parent
commit
18325aa59e
  1. 1
      README.md
  2. 2
      envs/local.env.dist
  3. 6
      healthcheck.py
  4. 276
      manuels/admin.py
  5. 2
      manuels/apps.py
  6. 2
      manuels/context_processors.py
  7. 133
      manuels/forms.py
  8. 2
      manuels/management/commands/clearcache.py
  9. 143
      manuels/migrations/0001_initial.py
  10. 33
      manuels/migrations/0002_auto_20180522_0132.py
  11. 52
      manuels/migrations/0003_auto_20180522_0145.py
  12. 50
      manuels/migrations/0004_auto_20180522_0148.py
  13. 52
      manuels/migrations/0005_suppliesrequirement.py
  14. 12
      manuels/migrations/0006_auto_20180522_1009.py
  15. 12
      manuels/migrations/0007_auto_20180522_1026.py
  16. 59
      manuels/migrations/0008_auto_20180522_1051.py
  17. 8
      manuels/migrations/0009_suppliesrequirement_field.py
  18. 6
      manuels/migrations/0010_remove_book_collection.py
  19. 14
      manuels/migrations/0011_auto_20180524_0013.py
  20. 14
      manuels/migrations/0012_auto_20180524_0014.py
  21. 26
      manuels/migrations/0013_auto_20180524_0016.py
  22. 8
      manuels/migrations/0014_auto_20180524_0034.py
  23. 8
      manuels/migrations/0015_auto_20180524_0035.py
  24. 14
      manuels/migrations/0016_auto_20180530_1801.py
  25. 14
      manuels/migrations/0017_auto_20180530_1804.py
  26. 12
      manuels/migrations/0018_book_comments.py
  27. 12
      manuels/migrations/0019_auto_20180531_0815.py
  28. 33
      manuels/migrations/0020_auto_20180602_1630.py
  29. 18
      manuels/migrations/0021_auto_20180602_1638.py
  30. 10
      manuels/migrations/0022_teacher_has_confirmed_list.py
  31. 12
      manuels/migrations/0023_auto_20180604_1827.py
  32. 8
      manuels/migrations/0024_book_other_editor.py
  33. 12
      manuels/migrations/0025_auto_20180607_0746.py
  34. 14
      manuels/migrations/0026_auto_20180616_0916.py
  35. 32
      manuels/migrations/0027_auto_20190401_2036.py
  36. 26
      manuels/migrations/0028_auto_20190406_1901.py
  37. 13
      manuels/migrations/0029_auto_20190406_1904.py
  38. 8
      manuels/migrations/0030_auto_20190406_1912.py
  39. 8
      manuels/migrations/0031_auto_20190406_1912.py
  40. 8
      manuels/migrations/0032_auto_20190406_1913.py
  41. 14
      manuels/migrations/0033_auto_20190406_1919.py
  42. 30
      manuels/migrations/0034_commonsupply.py
  43. 8
      manuels/migrations/0035_commonsupply_order.py
  44. 10
      manuels/migrations/0036_auto_20190615_1114.py
  45. 21
      manuels/migrations/0037_auto_20190627_1905.py
  46. 14
      manuels/migrations/0038_auto_20210510_0854.py
  47. 309
      manuels/models.py
  48. 1
      manuels/static/icons/.gitkeep
  49. 2
      manuels/templates/manuels/add_book.html
  50. 2
      manuels/templates/manuels/confirm_delete.html
  51. 2
      manuels/templates/manuels/home_page.html
  52. 2
      manuels/templates/manuels/list_books_supplies.html
  53. 2
      manuels/templates/manuels/supplies_message.html
  54. 1
      manuels/tests/test_inscription.py
  55. 61
      manuels/urls.py
  56. 2
      manuels/utils.py
  57. 161
      manuels/views.py
  58. 153
      manuels_collection/settings.py
  59. 10
      manuels_collection/urls.py

1
README.md

@ -19,4 +19,3 @@ git push heroku master
You may need to upgrade Python since Heroku tends to deprecate old patch versions rather quickly.
In this case, edit `runtime.txt`.

2
envs/local.env.dist

@ -7,4 +7,4 @@ SERVER_EMAIL=server@example.com
AUTHORIZED_EMAILS=user1@example.com,user2@example.com
LIBRARIAN_EMAILS=user3@example.com,user4@example.com
MAILGUN_ACCESS_KEY=access-key
MAILGUN_SERVER_NAME=mg.example.com
MAILGUN_SERVER_NAME=mg.example.com

6
healthcheck.py

@ -5,11 +5,11 @@ import requests
def main():
port = os.getenv('PORT', 8000)
res = requests.get(f'http://127.0.0.1:{port}/')
port = os.getenv("PORT", 8000)
res = requests.get(f"http://127.0.0.1:{port}/")
if res.status_code >= 400:
sys.exit(1)
if __name__ == '__main__':
if __name__ == "__main__":
main()

276
manuels/admin.py

@ -1,57 +1,78 @@
from django.contrib import admin, messages
from django.db.models import Prefetch
from import_export import resources, fields
from import_export import fields, resources
from import_export.admin import ExportMixin
from import_export.widgets import IntegerWidget, DecimalWidget
from import_export.widgets import DecimalWidget, IntegerWidget
from manuels.models import Teacher, Book, Level, Editor, SuppliesRequirement, CommonSupply, ISBNError
from manuels.models import (
Book,
CommonSupply,
Editor,
ISBNError,
Level,
SuppliesRequirement,
Teacher,
)
class TeacherResource(resources.ModelResource):
class Meta:
model = Teacher
fields = ('first_name', 'last_name', 'email', 'phone_number')
fields = ("first_name", "last_name", "email", "phone_number")
@admin.register(Teacher)
class TeacherAdmin(ExportMixin, admin.ModelAdmin):
resource_class = TeacherResource
list_display = ['full_name', 'email', 'phone_number', 'has_confirmed_list']
list_display = ["full_name", "email", "phone_number", "has_confirmed_list"]
def send_link(self, request, queryset):
for teacher in queryset:
teacher.send_link(request)
messages.success(request, f'Le lien a bien été envoyé aux {queryset.count()} coordonateur(s) sélectionné(s).')
messages.success(
request,
f"Le lien a bien été envoyé aux {queryset.count()} coordonateur(s) sélectionné(s).",
)
send_link.short_description = 'Envoyer le lien'
send_link.short_description = "Envoyer le lien"
actions = [send_link]
class LevelResource(resources.ModelResource):
non_acquired_book_count = fields.Field(attribute='non_acquired_book_count', widget=IntegerWidget())
non_acquired_book_price = fields.Field(attribute='non_acquired_book_price', widget=DecimalWidget())
non_acquired_consumable_count = fields.Field(attribute='non_acquired_consumable_count', widget=IntegerWidget())
non_acquired_consumable_price = fields.Field(attribute='non_acquired_consumable_price', widget=DecimalWidget())
non_acquired_total_price = fields.Field(attribute='non_acquired_total_price', widget=DecimalWidget())
non_acquired_book_count = fields.Field(
attribute="non_acquired_book_count", widget=IntegerWidget()
)
non_acquired_book_price = fields.Field(
attribute="non_acquired_book_price", widget=DecimalWidget()
)
non_acquired_consumable_count = fields.Field(
attribute="non_acquired_consumable_count", widget=IntegerWidget()
)
non_acquired_consumable_price = fields.Field(
attribute="non_acquired_consumable_price", widget=DecimalWidget()
)
non_acquired_total_price = fields.Field(
attribute="non_acquired_total_price", widget=DecimalWidget()
)
class Meta:
model = Level
fields = (
'name',
'non_acquired_book_count',
'non_acquired_book_price',
'non_acquired_consumable_count',
'non_acquired_consumable_price',
'non_acquired_total_price',
"name",
"non_acquired_book_count",
"non_acquired_book_price",
"non_acquired_consumable_count",
"non_acquired_consumable_price",
"non_acquired_total_price",
)
export_order = (
'name',
'non_acquired_book_count',
'non_acquired_book_price',
'non_acquired_consumable_count',
'non_acquired_consumable_price',
'non_acquired_total_price',
"name",
"non_acquired_book_count",
"non_acquired_book_price",
"non_acquired_consumable_count",
"non_acquired_consumable_price",
"non_acquired_total_price",
)
@ -59,87 +80,160 @@ class LevelResource(resources.ModelResource):
class LevelAdmin(ExportMixin, admin.ModelAdmin):
resource_class = LevelResource
list_display = [
'name',
'order',
'non_acquired_book_count',
'non_acquired_book_price',
'non_acquired_consumable_count',
'non_acquired_consumable_price',
'non_acquired_total_price',
"name",
"order",
"non_acquired_book_count",
"non_acquired_book_price",
"non_acquired_consumable_count",
"non_acquired_consumable_price",
"non_acquired_total_price",
]
list_editable = ['order']
list_display_links = ['name']
list_editable = ["order"]
list_display_links = ["name"]
def get_queryset(self, request):
return super(LevelAdmin, self).get_queryset(request).prefetch_related(
Prefetch("book_set", to_attr="prefetched_books"))
return (
super(LevelAdmin, self)
.get_queryset(request)
.prefetch_related(Prefetch("book_set", to_attr="prefetched_books"))
)
def non_acquired_book_count(self, obj: Level):
return obj.non_acquired_book_count
non_acquired_book_count.short_description = 'Nombre de livres à acheter (hors consommables)'
non_acquired_book_count.short_description = (
"Nombre de livres à acheter (hors consommables)"
)
def non_acquired_book_price(self, obj: Level):
return f'{obj.non_acquired_book_price:.2f}'
return f"{obj.non_acquired_book_price:.2f}"
non_acquired_book_price.short_description = 'Coût des livres à acheter (hors consommables)'
non_acquired_book_price.short_description = (
"Coût des livres à acheter (hors consommables)"
)
def non_acquired_consumable_count(self, obj: Level):
return obj.non_acquired_consumable_count
non_acquired_consumable_count.short_description = 'Nombre de consommables à acheter'
non_acquired_consumable_count.short_description = "Nombre de consommables à acheter"
def non_acquired_consumable_price(self, obj: Level):
return f'{obj.non_acquired_consumable_price:.2f}'
return f"{obj.non_acquired_consumable_price:.2f}"
non_acquired_consumable_price.short_description = 'Coût des consommables à acheter'
non_acquired_consumable_price.short_description = "Coût des consommables à acheter"
def non_acquired_total_price(self, obj: Level):
return f'{obj.non_acquired_total_price:.2f}'
return f"{obj.non_acquired_total_price:.2f}"
non_acquired_total_price.short_description = 'Coût total à acheter'
non_acquired_total_price.short_description = "Coût total à acheter"
class BookResource(resources.ModelResource):
decitre_url = fields.Field(attribute='decitre_url')
decitre_url = fields.Field(attribute="decitre_url")
class Meta:
model = Book
fields = ('title', 'authors', 'editor__name', 'publication_year', 'isbn', 'comments', 'other_editor',
'price', 'previously_acquired', 'teacher__first_name', 'teacher__last_name', 'level__name', 'field',
'consumable', "decitre_url")
export_order = ('level__name', 'field', 'title', 'authors', 'editor__name', 'publication_year', 'isbn', 'price',
'other_editor', 'previously_acquired', 'teacher__first_name', 'teacher__last_name', 'comments',
'consumable', "decitre_url")
fields = (
"title",
"authors",
"editor__name",
"publication_year",
"isbn",
"comments",
"other_editor",
"price",
"previously_acquired",
"teacher__first_name",
"teacher__last_name",
"level__name",
"field",
"consumable",
"decitre_url",
)
export_order = (
"level__name",
"field",
"title",
"authors",
"editor__name",
"publication_year",
"isbn",
"price",
"other_editor",
"previously_acquired",
"teacher__first_name",
"teacher__last_name",
"comments",
"consumable",
"decitre_url",
)
@admin.register(Book)
class BookAdmin(ExportMixin, admin.ModelAdmin):
resource_class = BookResource
list_display = ['level', 'field', 'title', 'authors', 'editor', 'other_editor', 'publication_year', 'isbn',
'price', 'previously_acquired', 'teacher', 'done', 'consumable']
list_editable = ['done']
list_filter = ['done', 'previously_acquired', 'consumable', 'level', 'editor', 'teacher']
list_display_links = ['title']
list_display = [
"level",
"field",
"title",
"authors",
"editor",
"other_editor",
"publication_year",
"isbn",
"price",
"previously_acquired",
"teacher",
"done",
"consumable",
]
list_editable = ["done"]
list_filter = [
"done",
"previously_acquired",
"consumable",
"level",
"editor",
"teacher",
]
list_display_links = ["title"]
fieldsets = [
('Infos livre', {
'fields': ('title', 'consumable', 'authors', ('editor', 'other_editor'), 'publication_year',
'isbn', 'created_at', 'updated_at', 'comments')
}),
('Élève', {
'fields': ('price', 'previously_acquired',)
}),
('Coordonnateur', {
'fields': ('teacher', 'level', 'field')
}),
('Gestion', {
'fields': ('done',)
}),
(
"Infos livre",
{
"fields": (
"title",
"consumable",
"authors",
("editor", "other_editor"),
"publication_year",
"isbn",
"created_at",
"updated_at",
"comments",
)
},
),
(
"Élève",
{
"fields": (
"price",
"previously_acquired",
)
},
),
("Coordonnateur", {"fields": ("teacher", "level", "field")}),
("Gestion", {"fields": ("done",)}),
]
readonly_fields = ['created_at', 'updated_at']
readonly_fields = ["created_at", "updated_at"]
def get_queryset(self, request):
return super(BookAdmin, self).get_queryset(request).select_related("editor", "level", "teacher")
return (
super(BookAdmin, self)
.get_queryset(request)
.select_related("editor", "level", "teacher")
)
def update_with_decitre(self, request, queryset):
for book in queryset:
@ -147,15 +241,15 @@ class BookAdmin(ExportMixin, admin.ModelAdmin):
book.update_from_decitre()
messages.success(
request,
f'Mise à jour réussie du livre "{book.title}" ({book.level.name} - {book.field})'
f'Mise à jour réussie du livre "{book.title}" ({book.level.name} - {book.field})',
)
except ISBNError as e:
messages.warning(
request,
f'Erreur lors de la mise à jour du livre "{book.title}" ({book.level.name} - {book.field}) : {e.data.get("error")}'
f'Erreur lors de la mise à jour du livre "{book.title}" ({book.level.name} - {book.field}) : {e.data.get("error")}',
)
update_with_decitre.short_description = 'Mettre à jour avec Decitre'
update_with_decitre.short_description = "Mettre à jour avec Decitre"
def mark_as_done(self, request, queryset):
queryset.update(done=True)
@ -171,25 +265,41 @@ class EditorAdmin(admin.ModelAdmin):
@admin.register(CommonSupply)
class CommonSupplyAdmin(admin.ModelAdmin):
list_display = ['name', 'order']
list_display_links = ['name']
list_editable = ['order']
list_display = ["name", "order"]
list_display_links = ["name"]
list_editable = ["order"]
class SuppliesResource(resources.ModelResource):
class Meta:
model = SuppliesRequirement
fields = ('supplies', 'field', 'level__name', 'teacher__first_name', 'teacher__last_name')
export_order = ('level__name', 'field', 'supplies', 'teacher__first_name', 'teacher__last_name')
fields = (
"supplies",
"field",
"level__name",
"teacher__first_name",
"teacher__last_name",
)
export_order = (
"level__name",
"field",
"supplies",
"teacher__first_name",
"teacher__last_name",
)
@admin.register(SuppliesRequirement)
class SuppliesRequirementAdmin(ExportMixin, admin.ModelAdmin):
resource_class = SuppliesResource
list_display = ['id', 'teacher', 'level', 'field', 'supplies', 'done']
list_editable = ['done']
readonly_fields = ['created_at', 'updated_at']
list_filter = ['done', 'teacher', 'level']
list_display = ["id", "teacher", "level", "field", "supplies", "done"]
list_editable = ["done"]
readonly_fields = ["created_at", "updated_at"]
list_filter = ["done", "teacher", "level"]
def get_queryset(self, request):
return super(SuppliesRequirementAdmin, self).get_queryset(request).select_related("level", "teacher")
return (
super(SuppliesRequirementAdmin, self)
.get_queryset(request)
.select_related("level", "teacher")
)

2
manuels/apps.py

@ -2,4 +2,4 @@ from django.apps import AppConfig
class ManuelsConfig(AppConfig):
name = 'manuels'
name = "manuels"

2
manuels/context_processors.py

@ -2,4 +2,4 @@ from django.conf import settings
def authorized_mails(request):
return {'authorized_mails': settings.AUTHORIZED_EMAILS}
return {"authorized_mails": settings.AUTHORIZED_EMAILS}

133
manuels/forms.py

@ -1,93 +1,136 @@
from django import forms
from django.core.exceptions import ValidationError
from manuels.models import Book, SuppliesRequirement, Level
from manuels.models import Book, Level, SuppliesRequirement
class EditBookForm(forms.ModelForm):
class Meta:
model = Book
fields = ['teacher', 'level', 'field', 'no_book', 'see_later', 'title', 'authors', 'editor', 'other_editor',
'publication_year', 'isbn', 'price', 'previously_acquired', 'comments', 'consumable']
no_book = forms.BooleanField(label='Pas de livre pour cette classe/matière', required=False, initial=False)
fields = [
"teacher",
"level",
"field",
"no_book",
"see_later",
"title",
"authors",
"editor",
"other_editor",
"publication_year",
"isbn",
"price",
"previously_acquired",
"comments",
"consumable",
]
no_book = forms.BooleanField(
label="Pas de livre pour cette classe/matière", required=False, initial=False
)
see_later = forms.BooleanField(
label='Voir à la rentrée', help_text="Notamment en cas de désaccord sur l'adoption ou non d'un manuel",
required=False, initial=False
label="Voir à la rentrée",
help_text="Notamment en cas de désaccord sur l'adoption ou non d'un manuel",
required=False,
initial=False,
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['title'].widget = forms.TextInput()
self.fields['authors'].widget = forms.TextInput()
self.fields['comments'].widget.attrs.update(rows=3)
self.fields['teacher'].widget.attrs.update({'class': 'custom-select'})
self.fields['editor'].widget.attrs.update({'class': 'custom-select'})
self.fields['previously_acquired'].widget.attrs.update({'class': 'custom-select'})
self.fields['consumable'].widget.attrs.update({'class': 'custom-select'})
if 'level' in self.fields:
self.fields['level'].widget.attrs.update({'class': 'custom-select'})
self.fields["title"].widget = forms.TextInput()
self.fields["authors"].widget = forms.TextInput()
self.fields["comments"].widget.attrs.update(rows=3)
self.fields["teacher"].widget.attrs.update({"class": "custom-select"})
self.fields["editor"].widget.attrs.update({"class": "custom-select"})
self.fields["previously_acquired"].widget.attrs.update(
{"class": "custom-select"}
)
self.fields["consumable"].widget.attrs.update({"class": "custom-select"})
if "level" in self.fields:
self.fields["level"].widget.attrs.update({"class": "custom-select"})
def clean(self):
editor = self.cleaned_data['editor']
other_editor = self.cleaned_data['other_editor']
title = self.cleaned_data['title']
if (editor
and 'autre' in editor.name.lower()
and not other_editor
and title not in ['PAS DE LIVRE POUR CETTE CLASSE', 'VOIR À LA RENTRÉE']):
editor = self.cleaned_data["editor"]
other_editor = self.cleaned_data["other_editor"]
title = self.cleaned_data["title"]
if (
editor
and "autre" in editor.name.lower()
and not other_editor
and title not in ["PAS DE LIVRE POUR CETTE CLASSE", "VOIR À LA RENTRÉE"]
):
self.add_error(
'other_editor',
"other_editor",
ValidationError(
"Vous devez préciser l'éditeur si vous n'en choisissez pas un parmi la liste.",
code='missing'
)
code="missing",
),
)
def clean_previously_acquired(self):
data = self.cleaned_data['previously_acquired']
if data is None or data == '':
raise ValidationError('Vous devez choisir une valeur')
data = self.cleaned_data["previously_acquired"]
if data is None or data == "":
raise ValidationError("Vous devez choisir une valeur")
return data
class AddBookForm(EditBookForm):
class Meta(EditBookForm.Meta):
fields = ['teacher', 'levels', 'field', 'no_book', 'see_later', 'title', 'authors', 'editor', 'other_editor',
'publication_year', 'isbn', 'price', 'previously_acquired', 'comments', 'add_another', 'consumable']
add_another = forms.BooleanField(label='Ajouter un autre livre', required=False, initial=True)
fields = [
"teacher",
"levels",
"field",
"no_book",
"see_later",
"title",
"authors",
"editor",
"other_editor",
"publication_year",
"isbn",
"price",
"previously_acquired",
"comments",
"add_another",
"consumable",
]
add_another = forms.BooleanField(
label="Ajouter un autre livre", required=False, initial=True
)
levels = forms.ModelMultipleChoiceField(
queryset=Level.objects.all(),
label='Classes',
label="Classes",
required=True,
help_text='Maintenez la touche Ctrl (ou Cmd) enfoncée pour en sélectionner plusieurs.'
help_text="Maintenez la touche Ctrl (ou Cmd) enfoncée pour en sélectionner plusieurs.",
)
class EditSuppliesForm(forms.ModelForm):
class Meta:
model = SuppliesRequirement
fields = ['teacher', 'level', 'field', 'supplies']
fields = ["teacher", "level", "field", "supplies"]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['supplies'].widget.attrs.update(rows=3)
self.fields['teacher'].widget.attrs.update({'class': 'custom-select'})
if 'level' in self.fields:
self.fields['level'].widget.attrs.update({'class': 'custom-select'})
self.fields["supplies"].widget.attrs.update(rows=3)
self.fields["teacher"].widget.attrs.update({"class": "custom-select"})
if "level" in self.fields:
self.fields["level"].widget.attrs.update({"class": "custom-select"})
class AddSuppliesForm(EditSuppliesForm):
class Meta(EditSuppliesForm.Meta):
fields = ['teacher', 'levels', 'field', 'supplies']
fields = ["teacher", "levels", "field", "supplies"]
add_another = forms.BooleanField(label="Ajouter d'autres fournitures", required=False, initial=True)
add_another = forms.BooleanField(
label="Ajouter d'autres fournitures", required=False, initial=True
)
levels = forms.ModelMultipleChoiceField(
queryset=Level.objects.all(),
label='Classes',
label="Classes",
required=True,
help_text='Maintenez la touche Ctrl (ou Cmd) enfoncée pour en sélectionner plusieurs.'
help_text="Maintenez la touche Ctrl (ou Cmd) enfoncée pour en sélectionner plusieurs.",
)

2
manuels/management/commands/clearcache.py

@ -3,7 +3,7 @@ from django.core.management import BaseCommand
class Command(BaseCommand):
help = 'Clears django cache'
help = "Clears django cache"
def handle(self, *args, **options):
cache.clear()

143
manuels/migrations/0001_initial.py

@ -1,71 +1,142 @@
# Generated by Django 2.0.5 on 2018-05-21 22:47
from django.db import migrations, models
import uuid
import django.db.models.deletion
from django.db import migrations, models
import manuels.models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
dependencies = []
operations = [
migrations.CreateModel(
name='Book',
name="Book",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('field', models.CharField(max_length=100, verbose_name='matière')),
('title', models.TextField(verbose_name='titre')),
('authors', models.TextField(verbose_name='auteurs')),
('editor', models.CharField(max_length=200, verbose_name='éditeur')),
('collection', models.CharField(blank=True, max_length=200, verbose_name='collection')),
('publication_year', models.PositiveIntegerField(verbose_name='année de publication')),
('isbn', models.CharField(max_length=20, validators=[manuels.models.isbn_validator], verbose_name='ISBN/EAN')),
('price', models.PositiveIntegerField(verbose_name='prix')),
('previously_acquired', models.BooleanField(choices=[(True, 'Oui'), (False, 'Non')], verbose_name="manuel acquis précédemment par l'élève")),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("field", models.CharField(max_length=100, verbose_name="matière")),
("title", models.TextField(verbose_name="titre")),
("authors", models.TextField(verbose_name="auteurs")),
("editor", models.CharField(max_length=200, verbose_name="éditeur")),
(
"collection",
models.CharField(
blank=True, max_length=200, verbose_name="collection"
),
),
(
"publication_year",
models.PositiveIntegerField(verbose_name="année de publication"),
),
(
"isbn",
models.CharField(
max_length=20,
validators=[manuels.models.isbn_validator],
verbose_name="ISBN/EAN",
),
),
("price", models.PositiveIntegerField(verbose_name="prix")),
(
"previously_acquired",
models.BooleanField(
choices=[(True, "Oui"), (False, "Non")],
verbose_name="manuel acquis précédemment par l'élève",
),
),
],
options={
'verbose_name': 'livre',
'verbose_name_plural': 'livres',
"verbose_name": "livre",
"verbose_name_plural": "livres",
},
),
migrations.CreateModel(
name='Level',
name="Level",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=10, verbose_name='nom')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=10, verbose_name="nom")),
],
options={
'verbose_name': 'classe',
'verbose_name_plural': 'classes',
"verbose_name": "classe",
"verbose_name_plural": "classes",
},
),
migrations.CreateModel(
name='Teacher',
name="Teacher",
fields=[
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=100, verbose_name='prénom')),
('last_name', models.CharField(max_length=100, verbose_name='nom')),
('phone_number', models.CharField(help_text="En cas d'urgence", max_length=10, verbose_name='numéro de téléphone')),
('email', models.EmailField(help_text='Utilisée pour vous transmettre votre lien personnel', max_length=254, unique=True, verbose_name='adresse email')),
(
"uuid",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("first_name", models.CharField(max_length=100, verbose_name="prénom")),
("last_name", models.CharField(max_length=100, verbose_name="nom")),
(
"phone_number",
models.CharField(
help_text="En cas d'urgence",
max_length=10,
verbose_name="numéro de téléphone",
),
),
(
"email",
models.EmailField(
help_text="Utilisée pour vous transmettre votre lien personnel",
max_length=254,
unique=True,
verbose_name="adresse email",
),
),
],
options={
'verbose_name': 'enseignant',
'verbose_name_plural': 'enseignants',
"verbose_name": "enseignant",
"verbose_name_plural": "enseignants",
},
),
migrations.AddField(
model_name='book',
name='level',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='manuels.Level', verbose_name='classe'),
model_name="book",
name="level",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="manuels.Level",
verbose_name="classe",
),
),
migrations.AddField(
model_name='book',
name='teacher',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='manuels.Teacher', verbose_name='enseignant'),
model_name="book",
name="teacher",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="manuels.Teacher",
verbose_name="enseignant",
),
),
]

33
manuels/migrations/0002_auto_20180522_0132.py

@ -1,30 +1,43 @@
# Generated by Django 2.0.5 on 2018-05-21 23:32
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0001_initial'),
("manuels", "0001_initial"),
]
operations = [
migrations.CreateModel(
name='Editor',
name="Editor",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50, verbose_name='nom')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=50, verbose_name="nom")),
],
options={
'verbose_name': 'éditeur',
'verbose_name_plural': 'éditeurs',
"verbose_name": "éditeur",
"verbose_name_plural": "éditeurs",
},
),
migrations.AlterField(
model_name='book',
name='editor',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='manuels.Editor', verbose_name='éditeur'),
model_name="book",
name="editor",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="manuels.Editor",
verbose_name="éditeur",
),
),
]

52
manuels/migrations/0003_auto_20180522_0145.py

@ -1,58 +1,66 @@
# Generated by Django 2.0.5 on 2018-05-21 23:45
from django.db import migrations, models
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0002_auto_20180522_0132'),
("manuels", "0002_auto_20180522_0132"),
]
operations = [
migrations.AddField(
model_name='book',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
model_name="book",
name="created_at",
field=models.DateTimeField(
auto_now_add=True, default=django.utils.timezone.now
),
preserve_default=False,
),
migrations.AddField(
model_name='book',
name='updated_at',
model_name="book",
name="updated_at",
field=models.DateTimeField(auto_now=True),
),
migrations.AddField(
model_name='editor',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
model_name="editor",
name="created_at",
field=models.DateTimeField(
auto_now_add=True, default=django.utils.timezone.now
),
preserve_default=False,
),
migrations.AddField(
model_name='editor',
name='updated_at',
model_name="editor",
name="updated_at",
field=models.DateTimeField(auto_now=True),
),
migrations.AddField(
model_name='level',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
model_name="level",
name="created_at",
field=models.DateTimeField(
auto_now_add=True, default=django.utils.timezone.now
),
preserve_default=False,
),
migrations.AddField(
model_name='level',
name='updated_at',
model_name="level",
name="updated_at",
field=models.DateTimeField(auto_now=True),
),
migrations.AddField(
model_name='teacher',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
model_name="teacher",
name="created_at",
field=models.DateTimeField(
auto_now_add=True, default=django.utils.timezone.now
),
preserve_default=False,
),
migrations.AddField(
model_name='teacher',
name='updated_at',
model_name="teacher",
name="updated_at",
field=models.DateTimeField(auto_now=True),
),
]

50
manuels/migrations/0004_auto_20180522_0148.py

@ -6,48 +6,48 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0003_auto_20180522_0145'),
("manuels", "0003_auto_20180522_0145"),
]
operations = [
migrations.AlterField(
model_name='book',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='créé le'),
model_name="book",
name="created_at",
field=models.DateTimeField(auto_now_add=True, verbose_name="créé le"),
),
migrations.AlterField(
model_name='book',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='mis à jour le'),
model_name="book",
name="updated_at",
field=models.DateTimeField(auto_now=True, verbose_name="mis à jour le"),
),
migrations.AlterField(
model_name='editor',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='créé le'),
model_name="editor",
name="created_at",
field=models.DateTimeField(auto_now_add=True, verbose_name="créé le"),
),
migrations.AlterField(
model_name='editor',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='mis à jour le'),
model_name="editor",
name="updated_at",
field=models.DateTimeField(auto_now=True, verbose_name="mis à jour le"),
),
migrations.AlterField(
model_name='level',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='créé le'),
model_name="level",
name="created_at",
field=models.DateTimeField(auto_now_add=True, verbose_name="créé le"),
),
migrations.AlterField(
model_name='level',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='mis à jour le'),
model_name="level",
name="updated_at",
field=models.DateTimeField(auto_now=True, verbose_name="mis à jour le"),
),
migrations.AlterField(
model_name='teacher',
name='created_at',
field=models.DateTimeField(auto_now_add=True, verbose_name='créé le'),
model_name="teacher",
name="created_at",
field=models.DateTimeField(auto_now_add=True, verbose_name="créé le"),
),
migrations.AlterField(
model_name='teacher',
name='updated_at',
field=models.DateTimeField(auto_now=True, verbose_name='mis à jour le'),
model_name="teacher",
name="updated_at",
field=models.DateTimeField(auto_now=True, verbose_name="mis à jour le"),
),
]

52
manuels/migrations/0005_suppliesrequirement.py

@ -1,29 +1,59 @@
# Generated by Django 2.0.5 on 2018-05-22 07:34
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0004_auto_20180522_0148'),
("manuels", "0004_auto_20180522_0148"),
]
operations = [
migrations.CreateModel(
name='SuppliesRequirement',
name="SuppliesRequirement",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='créé le')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='mis à jour le')),
('supplies', models.TextField(verbose_name='fournitures')),
('level', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='manuels.Level', verbose_name='classe')),
('teacher', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='manuels.Teacher', verbose_name='enseignant')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="créé le"),
),
(
"updated_at",
models.DateTimeField(auto_now=True, verbose_name="mis à jour le"),
),
("supplies", models.TextField(verbose_name="fournitures")),
(
"level",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="manuels.Level",
verbose_name="classe",
),
),
(
"teacher",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="manuels.Teacher",
verbose_name="enseignant",
),
),
],
options={
'verbose_name': 'demande de fournitures',
'verbose_name_plural': 'demandes de fournitures',
"verbose_name": "demande de fournitures",
"verbose_name_plural": "demandes de fournitures",
},
),
]

12
manuels/migrations/0006_auto_20180522_1009.py

@ -6,13 +6,17 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0005_suppliesrequirement'),
("manuels", "0005_suppliesrequirement"),
]
operations = [
migrations.AlterField(
model_name='book',
name='previously_acquired',
field=models.BooleanField(choices=[(True, 'Oui'), (False, 'Non')], default=False, verbose_name="manuel acquis précédemment par l'élève"),
model_name="book",
name="previously_acquired",
field=models.BooleanField(
choices=[(True, "Oui"), (False, "Non")],
default=False,
verbose_name="manuel acquis précédemment par l'élève",
),
),
]

12
manuels/migrations/0007_auto_20180522_1026.py

@ -6,13 +6,17 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0006_auto_20180522_1009'),
("manuels", "0006_auto_20180522_1009"),
]
operations = [
migrations.AlterField(
model_name='book',
name='previously_acquired',
field=models.BooleanField(choices=[(False, 'Non'), (True, 'Oui')], default=False, verbose_name="manuel acquis précédemment par l'élève"),
model_name="book",
name="previously_acquired",
field=models.BooleanField(
choices=[(False, "Non"), (True, "Oui")],
default=False,
verbose_name="manuel acquis précédemment par l'élève",
),
),
]

59
manuels/migrations/0008_auto_20180522_1051.py

@ -1,39 +1,64 @@
# Generated by Django 2.0.5 on 2018-05-22 08:51
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0007_auto_20180522_1026'),
("manuels", "0007_auto_20180522_1026"),
]
operations = [
migrations.AlterField(
model_name='book',
name='editor',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='manuels.Editor', verbose_name='éditeur'),
model_name="book",
name="editor",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="manuels.Editor",
verbose_name="éditeur",
),
),
migrations.AlterField(
model_name='book',
name='level',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='manuels.Level', verbose_name='classe'),
model_name="book",
name="level",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="manuels.Level",
verbose_name="classe",
),
),
migrations.AlterField(
model_name='book',
name='teacher',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='manuels.Teacher', verbose_name='enseignant'),
model_name="book",
name="teacher",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="manuels.Teacher",
verbose_name="enseignant",
),
),
migrations.AlterField(
model_name='suppliesrequirement',
name='level',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='manuels.Level', verbose_name='classe'),
model_name="suppliesrequirement",
name="level",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="manuels.Level",
verbose_name="classe",
),
),
migrations.AlterField(
model_name='suppliesrequirement',
name='teacher',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='manuels.Teacher', verbose_name='enseignant'),
model_name="suppliesrequirement",
name="teacher",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="manuels.Teacher",
verbose_name="enseignant",
),
),
]

8
manuels/migrations/0009_suppliesrequirement_field.py

@ -6,14 +6,14 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0008_auto_20180522_1051'),
("manuels", "0008_auto_20180522_1051"),
]
operations = [
migrations.AddField(
model_name='suppliesrequirement',
name='field',
field=models.CharField(default='', max_length=100, verbose_name='matière'),
model_name="suppliesrequirement",
name="field",
field=models.CharField(default="", max_length=100, verbose_name="matière"),
preserve_default=False,
),
]

6
manuels/migrations/0010_remove_book_collection.py

@ -6,12 +6,12 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('manuels', '0009_suppliesrequirement_field'),
("manuels", "0009_suppliesrequirement_field"),
]
operations = [
migrations.RemoveField(
model_name='book',
name='collection',
model_name="book",
name="collection",
),
]

14
manuels/migrations/0011_auto_20180524_0013.py

@ -1,19 +1,25 @@
# Generated by Django 2.0.5 on 2018-05-23 22:13
from django.db import migrations, models
import manuels.models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0010_remove_book_collection'),
("manuels", "0010_remove_book_collection"),
]
operations = [
migrations.AlterField(
model_name='teacher',
name='phone_number',
field=models.CharField(help_text="En cas d'urgence, 10 chiffres.", max_length=10, validators=[manuels.models.phone_validator], verbose_name='numéro de téléphone'),
model_name="teacher",
name="phone_number",
field=models.CharField(
help_text="En cas d'urgence, 10 chiffres.",
max_length=10,
validators=[manuels.models.phone_validator],
verbose_name="numéro de téléphone",
),
),
]

14
manuels/migrations/0012_auto_20180524_0014.py

@ -1,19 +1,25 @@
# Generated by Django 2.0.5 on 2018-05-23 22:14
from django.db import migrations, models
import manuels.models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0011_auto_20180524_0013'),
("manuels", "0011_auto_20180524_0013"),
]
operations = [
migrations.AlterField(
model_name='book',
name='isbn',
field=models.CharField(help_text='Format attendu : 10 ou 13 chiffres, éventuellement séparés par des tirets et éventuellement suivis de la lettre <code>X</code>', max_length=20, validators=[manuels.models.isbn_validator], verbose_name='ISBN/EAN'),
model_name="book",
name="isbn",
field=models.CharField(
help_text="Format attendu : 10 ou 13 chiffres, éventuellement séparés par des tirets et éventuellement suivis de la lettre <code>X</code>",
max_length=20,
validators=[manuels.models.isbn_validator],
verbose_name="ISBN/EAN",
),
),
]

26
manuels/migrations/0013_auto_20180524_0016.py

@ -6,28 +6,28 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manuels', '0012_auto_20180524_0014'),
("manuels", "0012_auto_20180524_0014"),
]
operations = [
migrations.AlterField(
model_name='book',
name='field',
field=models.CharField(max_length=200, verbose_name='matière'),
model_name="book",
name="field",
field=models.CharField(max_length=200, verbose_name="matière"),
),
migrations.AlterField(
model_name='editor',
name='name',
field=models.CharField(max_length=100, verbose_name='nom'),
model_name="editor",
name="name",
field=models.CharField(max_length=100, verbose_name="nom"),
),
migrations.AlterField(
model_name='level',
name='name',