Opened 7 years ago

Closed 14 months ago

#8270 closed New feature (fixed)

Add convenience method to ContentTypeManager

Reported by: jdunck 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 jdunck 7 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 7 years ago by jdunck

Adds get_for_app_label_and_model_name to ContentTypeManager. Obviously a terrible name.

comment:1 Changed 7 years ago by jdunck

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

comment:2 Changed 7 years ago by jacob

  • milestone post-1.0 deleted
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 7 years ago by jacob

  • milestone set to post-1.0

comment:4 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:5 Changed 4 years ago by gabrielhurley

  • Component changed from Contrib apps to contrib.contenttypes

comment:6 Changed 4 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:7 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:8 Changed 3 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:9 Changed 14 months ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

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