Add autcomplete to ingredient inline
This commit is contained in:
parent
0a98e4a778
commit
1f9d5f8291
|
@ -4,8 +4,14 @@ from django.contrib import admin
|
||||||
from .models import Composition, Ingredient, Recette, Unite
|
from .models import Composition, Ingredient, Recette, Unite
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Ingredient)
|
||||||
|
class IngredientAdmin(admin.ModelAdmin):
|
||||||
|
search_fields = ['nom']
|
||||||
|
|
||||||
|
|
||||||
class IngredientInline(admin.TabularInline):
|
class IngredientInline(admin.TabularInline):
|
||||||
model = Recette.ingredients.through
|
model = Recette.ingredients.through
|
||||||
|
autocomplete_fields = ['ingredient']
|
||||||
|
|
||||||
|
|
||||||
class RecetteForm(forms.ModelForm):
|
class RecetteForm(forms.ModelForm):
|
||||||
|
@ -26,5 +32,4 @@ class RecetteAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Composition)
|
admin.site.register(Composition)
|
||||||
admin.site.register(Ingredient)
|
|
||||||
admin.site.register(Unite)
|
admin.site.register(Unite)
|
||||||
|
|
Loading…
Reference in a new issue