#34292: Support display function in InlineModelAdmin
-------------------------------+--------------------------------------
     Reporter:  Al Mahdi       |                    Owner:  nobody
         Type:  New feature    |                   Status:  new
    Component:  contrib.admin  |                  Version:  4.2
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Description changed by Al Mahdi:

Old description:

> {{{InlineModelAdmin}}} doesn't support display function
>
> {{{
> from django.contrib import admin
>
> class SaleInline(admin.TabularInline):
>     model = Sale
>
>     @admin.display(description="Price")
>     def cost(sale):
>         return sale.price - sale.discount
>
>     fields = ("product", "count", "cost")
> }}}
>

> == FieldError
> **Unknown field(s) (cost) specified for Sale**

New description:

 {{{InlineModelAdmin}}} doesn't support display function

 {{{
 from django.contrib import admin

 class SaleInline(admin.TabularInline):
     model = Sale

     @admin.display(description="Price")
     def cost(self, sale):
         return sale.price - sale.discount

     fields = ("product", "count", "cost")
 }}}


 == FieldError
 **Unknown field(s) (cost) specified for Sale**

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34292#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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070185e9a162af-1ba3bba7-19af-4a2c-9c94-b8bd81960511-000000%40eu-central-1.amazonses.com.

Reply via email to