Allow multiple fields for supplies
This commit is contained in:
parent
70fa58fd46
commit
20ef3ce11d
4 changed files with 40 additions and 3 deletions
|
@ -68,12 +68,13 @@ class EditorAdmin(admin.ModelAdmin):
|
||||||
class SuppliesResource(resources.ModelResource):
|
class SuppliesResource(resources.ModelResource):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SuppliesRequirement
|
model = SuppliesRequirement
|
||||||
fields = ('supplies', 'level__name', 'teacher__first_name', 'teacher__last_name')
|
fields = ('supplies', 'fields', 'level__name', 'teacher__first_name', 'teacher__last_name')
|
||||||
|
export_order = ('fields', 'supplies', 'teacher__first_name', 'teacher__last_name', 'level__name')
|
||||||
|
|
||||||
|
|
||||||
@admin.register(SuppliesRequirement)
|
@admin.register(SuppliesRequirement)
|
||||||
class SuppliesRequirementAdmin(ExportMixin, admin.ModelAdmin):
|
class SuppliesRequirementAdmin(ExportMixin, admin.ModelAdmin):
|
||||||
resource_class = SuppliesResource
|
resource_class = SuppliesResource
|
||||||
list_display = ['teacher', 'level', 'supplies']
|
list_display = ['id', 'teacher', 'level', 'fields', 'supplies']
|
||||||
readonly_fields = ['created_at', 'updated_at']
|
readonly_fields = ['created_at', 'updated_at']
|
||||||
list_filter = ['teacher', 'level']
|
list_filter = ['teacher', 'level']
|
||||||
|
|
18
manuels/migrations/0014_auto_20180524_0034.py
Normal file
18
manuels/migrations/0014_auto_20180524_0034.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.0.5 on 2018-05-23 22:34
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('manuels', '0013_auto_20180524_0016'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='suppliesrequirement',
|
||||||
|
old_name='field',
|
||||||
|
new_name='fields',
|
||||||
|
),
|
||||||
|
]
|
18
manuels/migrations/0015_auto_20180524_0035.py
Normal file
18
manuels/migrations/0015_auto_20180524_0035.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.0.5 on 2018-05-23 22:35
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('manuels', '0014_auto_20180524_0034'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='suppliesrequirement',
|
||||||
|
name='fields',
|
||||||
|
field=models.TextField(verbose_name='matières'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -151,7 +151,7 @@ class SuppliesRequirement(BaseModel):
|
||||||
|
|
||||||
teacher = models.ForeignKey(verbose_name='enseignant', to=Teacher, on_delete=models.PROTECT, null=True)
|
teacher = models.ForeignKey(verbose_name='enseignant', to=Teacher, on_delete=models.PROTECT, null=True)
|
||||||
level = models.ForeignKey(verbose_name='classe', to=Level, on_delete=models.PROTECT, null=True)
|
level = models.ForeignKey(verbose_name='classe', to=Level, on_delete=models.PROTECT, null=True)
|
||||||
field = models.CharField('matière', max_length=200)
|
fields = models.TextField('matières')
|
||||||
supplies = models.TextField('fournitures')
|
supplies = models.TextField('fournitures')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
Loading…
Reference in a new issue