[Django] #34292: Support display function in InlineModelAdmin

2 views
Skip to first unread message

Django

unread,
Jan 25, 2023, 10:51:41 AM1/25/23
to django-...@googlegroups.com
#34292: Support display function in InlineModelAdmin
-----------------------------------------+------------------------
Reporter: Al Mahdi | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
{{{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**

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

Django

unread,
Jan 25, 2023, 10:52:33 AM1/25/23
to django-...@googlegroups.com
#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

unread,
Jan 25, 2023, 11:16:59 AM1/25/23
to django-...@googlegroups.com
#34292: Support display function in InlineModelAdmin
-------------------------------+--------------------------------------
Reporter: Al Mahdi | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 4.1

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
-------------------------------+--------------------------------------
Changes (by Al Mahdi):

* version: 4.2 => 4.1


--
Ticket URL: <https://code.djangoproject.com/ticket/34292#comment:2>

Django

unread,
Jan 26, 2023, 12:16:18 AM1/26/23
to django-...@googlegroups.com
#34292: Support display function in InlineModelAdmin
-------------------------------+--------------------------------------
Reporter: Al Mahdi | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 4.1
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

`cost` should be added to the
[https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields
readonly_fields].

Please don't use Trac as a support channel. Closing per
TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/34292#comment:3>

Reply all
Reply to author
Forward
0 new messages