#28057: Admin inlines very slow to render
--------------------------------+--------------------------------------
     Reporter:  Marc DEBUREAUX  |                    Owner:  nobody
         Type:  Bug             |                   Status:  new
    Component:  contrib.admin   |                  Version:  1.11
     Severity:  Normal          |               Resolution:
     Keywords:  admin inlines   |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  1
--------------------------------+--------------------------------------
Description changed by Marc DEBUREAUX:

Old description:

> When using inlines in Django admin, it renders very poorly even when
> creating a new element (so no data to load, database time always the
> same).
>
> And the higher the number in "extra" parameter, the longer it takes to
> load the form.
>

> {{{
> class EffectModifierInline(admin.TabularInline):
>     model = EffectModifier
>     extra = 1
>

> @admin.register(Effect)
> class EffectAdmin(admin.ModelAdmin):
>     fieldsets = (
>         # Whatever
>     )
>     inlines = [EffectModifierInline]
>     # TODO:
>     list_display = ()
>     list_editable = ()
>     list_filter = ()
>
>     def get_queryset(self, request):
>         return
> super().get_queryset(request).prefetch_related('modifiers')
> }}}
>
> ''With 15 inlines''
> [[Image(https://cdn.pbrd.co/images/1VQk4eH7X.png)]]
>
> ''With only 1 inline''
> [[Image(https://cdn.pbrd.co/images/1VSyev0B9.png)]]
>
> ''With no inline''
> [[Image(https://cdn.pbrd.co/images/1VTx3aMU3.png)]]

New description:

 When using inlines in Django admin, it renders very poorly even when
 creating a new element (so no data to load, database time always the
 same).

 And the higher the number in "extra" parameter, the longer it takes to
 load the form.

 **Works well with Django 1.10**


 {{{
 class EffectModifierInline(admin.TabularInline):
     model = EffectModifier
     extra = 1


 @admin.register(Effect)
 class EffectAdmin(admin.ModelAdmin):
     fieldsets = (
         # Whatever
     )
     inlines = [EffectModifierInline]
     # TODO:
     list_display = ()
     list_editable = ()
     list_filter = ()

     def get_queryset(self, request):
         return super().get_queryset(request).prefetch_related('modifiers')
 }}}

 ''With 15 inlines''
 [[Image(https://cdn.pbrd.co/images/1VQk4eH7X.png)]]

 ''With only 1 inline''
 [[Image(https://cdn.pbrd.co/images/1VSyev0B9.png)]]

 ''With no inline''
 [[Image(https://cdn.pbrd.co/images/1VTx3aMU3.png)]]

--

--
Ticket URL: <https://code.djangoproject.com/ticket/28057#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.38a0d8c1a01d78077a70b911f6bd4c0c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to