Run pre-commit

This commit is contained in:
Gabriel Augendre 2021-07-10 12:11:58 +02:00
parent 64c58260d9
commit 18325aa59e
59 changed files with 1227 additions and 747 deletions

View file

@ -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`.

View file

@ -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

View file

@ -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()

View file

@ -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']
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',)
}),
list_display = [
"level",
"field",
"title",
"authors",
"editor",
"other_editor",
"publication_year",
"isbn",
"price",
"previously_acquired",
"teacher",
"done",
"consumable",
]
readonly_fields = ['created_at', 'updated_at']
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",)}),
]
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")
)

View file

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

View file

@ -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}

View file

@ -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']
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)
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']
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']):
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']
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)
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.",
)

View file

@ -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()

View file

@ -1,71 +1,142 @@
# Generated by Django 2.0.5 on 2018-05-21 22:47
from django.db import migrations, models
import django.db.models.deletion
import manuels.models
import uuid
import django.db.models.deletion
from django.db import migrations, models
import manuels.models
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",
),
),
]

View file

@ -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",
),
),
]

View file

@ -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),
),
]

View file

@ -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"),
),
]

View file

@ -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",
},
),
]

View file

@ -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",
),
),
]

View file

@ -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",
),
),
]

View file

@ -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",
),
),
]

View file

@ -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,
),
]

View file

@ -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",
),
]

View file

@ -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 =