Opened 2 months ago

Closed 2 months ago

#32421 closed New feature (fixed)

Add @cached_property in admindocs

Reported by: Nat S Dunn Owned by: Ramon Saraiva
Component: contrib.admindocs Version: dev
Severity: Normal Keywords: cached_property
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Nat S Dunn)

From the documentation (https://docs.djangoproject.com/en/3.1/ref/contrib/admin/admindocs/): "The models section of the admindocs page describes each model in the system along with all the fields, properties, and methods available on it."

Currently, properties decorated with @cached_property are not included. Please include them. And possibly include other (or all) descriptors/attributes.

Change History (10)

comment:1 Changed 2 months ago by Nat S Dunn

Description: modified (diff)

comment:2 Changed 2 months ago by Mariusz Felisiak

Triage Stage: UnreviewedAccepted
Version: 3.1master

Agreed, we should include include cached properties (@cached_property). I'm not sure about other descriptors and attributes, not all of them are reasonable. I think we should end there.

comment:3 Changed 2 months ago by Ramon Saraiva

Owner: changed from nobody to Ramon Saraiva
Status: newassigned

comment:4 Changed 2 months ago by Ramon Saraiva

How do you guys suggest the visualization of the @cached_property in the fields table?
I thought about something like {field_name} (cached property) in the field column.

comment:5 in reply to:  4 ; Changed 2 months ago by Nat S Dunn

Replying to Ramon Saraiva:
I like the idea of indicating that it is a cached property using {field_name} (cached property) in the field column, but currently there is no distinction made for properties vs. fields, so if you were to do that, it would make sense to do the same thing for standard properties - {field_name} (property), which would be helpful, but that may be out of the scope of this issue. I'm not sure how that works. Thanks for taking this on, by the way!

comment:6 in reply to:  5 ; Changed 2 months ago by Ramon Saraiva

Replying to Nat S Dunn:
Would be straight forward to also add {field_name} (property) to properties. Another way would be adding something to the Description column.

Last edited 2 months ago by Ramon Saraiva (previous) (diff)

comment:7 in reply to:  6 Changed 2 months ago by Nat S Dunn

Replying to Ramon Saraiva:
Cool. I'd prefer it in the Fields column like in your original suggestion. The Description column can get pretty busy.

Last edited 2 months ago by Nat S Dunn (previous) (diff)

comment:8 Changed 2 months ago by Mariusz Felisiak

Has patch: set

comment:9 Changed 2 months ago by Mariusz Felisiak

Triage Stage: AcceptedReady for checkin

comment:10 Changed 2 months ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In dcb094ab:

Fixed #32421 -- Made admindocs ModelDetailView show model cached properties.

Note: See TracTickets for help on using tickets.
Back to Top