# Admin Django (Django) > ModelAdmin, list_display, list_filter, search_fields, inlines, custom actions, personnalisation de l'admin - 20 questions d'entretien - Confirmé - [Questions d'entretien: Django](https://sharpskill.dev/fr/technologies/django/questions-entretien.md) ## 1. Quel est le rôle principal de la classe ModelAdmin dans Django ? **Réponse** ModelAdmin est la classe qui représente un modèle dans l'interface d'administration Django. Elle permet de personnaliser l'affichage et le comportement d'un modèle dans l'admin, incluant les colonnes affichées, les filtres disponibles et les actions possibles. Pour l'utiliser, il faut créer une sous-classe de ModelAdmin et l'enregistrer avec le modèle correspondant. ## 2. Comment enregistrer un modèle avec sa classe ModelAdmin personnalisée dans Django ? **Réponse** Pour enregistrer un modèle avec une classe ModelAdmin personnalisée, utiliser admin.site.register() en passant le modèle et la classe ModelAdmin en arguments. Une alternative est d'utiliser le décorateur @admin.register(Model) sur la classe ModelAdmin. L'enregistrement se fait généralement dans le fichier admin.py de l'application. ## 3. À quoi sert l'attribut list_display dans une classe ModelAdmin ? **Réponse** L'attribut list_display permet de spécifier quelles colonnes afficher dans la liste des objets de l'admin. Il accepte un tuple ou une liste de noms de champs du modèle, de callables, ou de méthodes de la ModelAdmin. Par défaut, seule la représentation __str__ du modèle est affichée. list_display améliore grandement la lisibilité et l'ergonomie de l'interface d'administration. ## 17 questions supplémentaires disponibles - Comment ajouter une colonne personnalisée basée sur un calcul dans list_display ? - Quel est le rôle de l'attribut list_filter dans ModelAdmin ? S'inscrire gratuitement: https://sharpskill.dev/fr/login ## Autres sujets d'entretien Django - [Les bases de Python](https://sharpskill.dev/fr/technologies/django/questions-entretien/python-basics.md): 25 questions, Junior - [Python orienté objet](https://sharpskill.dev/fr/technologies/django/questions-entretien/python-oop.md): 20 questions, Junior - [Fondamentaux Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-fundamentals.md): 20 questions, Junior - [Models Django - Bases](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-models-basics.md): 22 questions, Junior - [Vues Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-views.md): 20 questions, Junior - [Templates Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-templates.md): 18 questions, Junior - [Formulaires Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-forms.md): 22 questions, Confirmé - [QuerySets avancés](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-querysets.md): 25 questions, Confirmé - [Authentification Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-authentication.md): 22 questions, Confirmé - [Middleware Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-middleware.md): 18 questions, Confirmé - [Django REST Framework](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-rest-framework.md): 30 questions, Confirmé - [Signaux Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-signals.md): 18 questions, Confirmé - [Upload de fichiers](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-file-upload.md): 20 questions, Confirmé - [Cache Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-caching.md): 20 questions, Confirmé - [Sessions Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-sessions.md): 18 questions, Confirmé - [Email Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-email.md): 18 questions, Confirmé - [Tests Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-testing.md): 22 questions, Confirmé - [Sécurité Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-security.md): 22 questions, Confirmé - [Déploiement Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-deployment.md): 24 questions, Confirmé - [ORM Django avancé](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-orm-advanced.md): 28 questions, Senior - [Performance Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-performance.md): 24 questions, Senior - [Django & Celery](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-celery.md): 22 questions, Senior - [Django Channels](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-channels.md): 24 questions, Senior - [Django & GraphQL](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-graphql.md): 24 questions, Senior - [Django & Docker](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-docker.md): 20 questions, Senior - [Django dans un écosystème Microservices](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-microservices.md): 24 questions, Senior - [Commandes Django personnalisées](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-custom-commands.md): 18 questions, Senior - [Internationalisation Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-internationalization.md): 20 questions, Senior - [Design Patterns Django](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-design-patterns.md): 24 questions, Senior - [Django Async & ASGI](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-async-asgi.md): 26 questions, Senior - [Settings & Configuration Production](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-settings-configuration.md): 22 questions, Senior - [Observabilité & Monitoring](https://sharpskill.dev/fr/technologies/django/questions-entretien/django-observability.md): 24 questions, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/fr/technologies/django/questions-entretien/django-admin