Opened 4 years ago

Closed 4 years 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 by Nat S Dunn, 4 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 4 years ago

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 by Ramon Saraiva, 4 years ago

Owner: changed from nobody to Ramon Saraiva
Status: newassigned

comment:4 by Ramon Saraiva, 4 years ago

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.

in reply to:  4 ; comment:5 by Nat S Dunn, 4 years ago

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!

in reply to:  5 ; comment:6 by Ramon Saraiva, 4 years ago

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 4 years ago by Ramon Saraiva (previous) (diff)

in reply to:  6 comment:7 by Nat S Dunn, 4 years ago

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 4 years ago by Nat S Dunn (previous) (diff)

comment:8 by Mariusz Felisiak, 4 years ago

Has patch: set

comment:9 by Mariusz Felisiak, 4 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

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