[Answered ]-Is it possible to allow to create objects from the list_display view of the django admin site?

1👍

Unfortunately this feature is not available out-of-the box in the Django admin like the ModelAdmin.list_editable feature.

I’m curious to see if there are other shortcuts, but at the moment the only way I see is to customize the formset like descibed in the official Docs:

from django import forms

class MyForm(forms.ModelForm):
    # customize your 'extra' forms here

class MyModelAdmin(admin.ModelAdmin):
    def get_changelist_form(self, request, **kwargs):
        return MyForm

And finally manually extend the changelist form template of the admin. To override a Django admin template, please follow the intructions in the Official Docs here. The template to be customized is the following folder:

.../django/contrib/admin/templates/admin/change_list.html

and you probably need to override the {% block result_list %} in that file.

NB: the customization of an admin template can be very tricky. Consider to use a CMS (like DjangoCMS) if you need to extend the user experience. The idea behind the Django admin is to make your life easier with an out-of-the-box interface for CRUDs on your DB. IMHO try to avoid complex customizations of the Django Admin if not strictly needed.

👤Dos

Leave a comment