Opened 8 years ago

Closed 2 years ago

#8270 closed New feature (fixed)

Add convenience method to ContentTypeManager

Reported by: Jeremy Dunck Owned by: nobody
Component: contrib.contenttypes Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

app_label, model_name (e.g. ('news', 'story')) is often passed around internally in our codebase.

The attached patch would be nice in Django, since otherwise we do a little hula to get the ContentType object. Doing a direct query would miss the handy cache ContentTypeManager includes.

Attachments (1)

contenttype-label.diff (1.0 KB) - added by Jeremy Dunck 8 years ago.
Adds get_for_app_label_and_model_name to ContentTypeManager. Obviously a terrible name.

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by Jeremy Dunck

Attachment: contenttype-label.diff added

Adds get_for_app_label_and_model_name to ContentTypeManager. Obviously a terrible name.

comment:1 Changed 8 years ago by Jeremy Dunck

To be clear, in my report here, by "our codebase", I mean the codebase for pegasusnews.com, not Django itself.

comment:2 Changed 8 years ago by Jacob

milestone: post-1.0
Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Jacob

milestone: post-1.0

comment:4 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:5 Changed 6 years ago by Gabriel Hurley

Component: Contrib appscontrib.contenttypes

comment:6 Changed 5 years ago by Luke Plant

Severity: Normal
Type: New feature

comment:7 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:8 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:9 Changed 2 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed

This feature was added as ContentTypeManager.get_by_natural_key.

It's a side effect of a large patch, 35cc439228cd32dfa7a3ec919db01a8a5cd17d33.

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