Add autcomplete to ingredient inline

This commit is contained in:
Claude Paroz 2018-06-01 20:47:57 +02:00
parent 0a98e4a778
commit 1f9d5f8291

View file

@ -4,8 +4,14 @@ from django.contrib import admin
from .models import Composition, Ingredient, Recette, Unite
@admin.register(Ingredient)
class IngredientAdmin(admin.ModelAdmin):
search_fields = ['nom']
class IngredientInline(admin.TabularInline):
model = Recette.ingredients.through
autocomplete_fields = ['ingredient']
class RecetteForm(forms.ModelForm):
@ -26,5 +32,4 @@ class RecetteAdmin(admin.ModelAdmin):
admin.site.register(Composition)
admin.site.register(Ingredient)
admin.site.register(Unite)