from django.contrib import admin

from .models import Event, Participants


class ParticipantsAdmin(admin.ModelAdmin):
    fields = [
        "event",
        "participant",
        "reponse",
        "instrument",
        "instrument_autre",
        "dont_play_main",
        "details",
        "creationDate",
        "updateDate",
    ]
    readonly_fields = ["creationDate", "updateDate"]
    list_display = ["participant", "event", "reponse", "creationDate", "updateDate"]
    def has_add_permission(self, req):
        return False
    def has_change_permission(self,obj, change=False):
        return False


# Add event by admin page return a 502 error
admin.site.register(Event)
admin.site.register(Participants, ParticipantsAdmin)
