Admin: on utilise la recherche builtin de Django

This commit is contained in:
Martin Pépin 2020-12-04 19:33:17 +01:00
parent 479e751b7c
commit 49fde85187
No known key found for this signature in database
GPG key ID: E7520278B1774448

View file

@ -33,20 +33,6 @@ class ReadOnlyMixin(object):
return readonly_fields + self.readonly_fields_update return readonly_fields + self.readonly_fields_update
class ChoixSpectacleAdminForm(forms.ModelForm):
class Meta:
widgets = {
"participant": ModelSelect2(url="bda-participant-autocomplete"),
"spectacle": ModelSelect2(url="bda-spectacle-autocomplete"),
}
class ChoixSpectacleInline(admin.TabularInline):
model = ChoixSpectacle
form = ChoixSpectacleAdminForm
sortable_field_name = "priority"
class AttributionTabularAdminForm(forms.ModelForm): class AttributionTabularAdminForm(forms.ModelForm):
listing = None listing = None
@ -238,7 +224,7 @@ class AttributionAdmin(ReadOnlyMixin, admin.ModelAdmin):
class ChoixSpectacleAdmin(admin.ModelAdmin): class ChoixSpectacleAdmin(admin.ModelAdmin):
form = ChoixSpectacleAdminForm autocomplete_fields = ["participant", "spectacle"]
def tirage(self, obj): def tirage(self, obj):
return obj.participant.tirage return obj.participant.tirage