Opened 12 years ago

Closed 12 years ago

#19345 closed Bug (wontfix)

ContentType.objects.get_for_model shouldn't create missing content types

Reported by: Aymeric Augustin Owned by: nobody
Component: contrib.contenttypes Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This behavior is very unexpected, given the name of the method.

In general, this isn't an issue because content types always exist — they're created in post_syncdb.

I encountered the problem while debugging multiple databases issues involving syncdb (#16039). The post_syncdb handler that creates permissions looks for content types, creating them as a side effect. Since I was attempting to test that the content types weren't created, my test failed in a very unexpected fashion.

Change History (3)

comment:1 by Preston Holmes, 12 years ago

Seems that this behavior is fully intentional and long standing based on code comments and git-blame.

Given that as you say - this is mostly a non-issue either way under normal usage, and there is a slim chance that the backwards incompatible change to raise an error could cause some edge case breakage - wouldn't it be better to leave as is and just access the ContentType model through standard manager methods?

Basically - is this worth changing?

comment:2 by Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedDesign decision needed

comment:3 by Aymeric Augustin, 12 years ago

Resolution: wontfix
Status: newclosed

I can't come up with a sufficiently good reason to justify changing this, and I suppose I can live with it, if I never attempt to debug syncdb again ;)

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