Add photo booleans in recette admin

This commit is contained in:
Claude Paroz 2018-10-14 20:25:16 +02:00
parent ea6bb20ab3
commit 28c3908099

View file

@ -33,9 +33,20 @@ class RecetteForm(forms.ModelForm):
@admin.register(Recette) @admin.register(Recette)
class RecetteAdmin(admin.ModelAdmin): class RecetteAdmin(admin.ModelAdmin):
list_display = ['nom', 'has_photo', 'has_photo_instr']
form = RecetteForm form = RecetteForm
inlines = [IngredientInline] inlines = [IngredientInline]
def has_photo(self, obj):
return bool(obj.photo)
has_photo.short_description = "Avec photo"
has_photo.boolean = True
def has_photo_instr(self, obj):
return bool(obj.photo_instr)
has_photo_instr.short_description = "Avec photo instructions"
has_photo_instr.boolean = True
admin.site.register(Composition) admin.site.register(Composition)
admin.site.register(Unite) admin.site.register(Unite)