﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27580	add special field for storing content types	Sergey Fedoseev		"`ContentType` model is quite specific, so we could add the subclass of ForeignKey field with some specific features.

For example we have such model:

{{{
#!python
class ModelWithContentTypeField(models.Model):
    ct = ContentTypeField(on_delete=models.CASCADE)
}}}

In comparison with `ForeignKey` `ContentTypeField` will have these features:

1. `ModelWithContentTypeField.objects.first().ct` will use content types cache.

2. `ContentTypeField` will support lookups on the model classes:
`ModelWithContentTypeField.objects.filter(ct=FooModel)` vs `ModelWithContentTypeField.objects.filter(ct=ContentType.objects.get_for_model(FooModel))` 

`ModelWithContentTypeField.objects.filter(ct__in=[FooModel, BarModel])` vs 
`ModelWithContentTypeField.objects.filter(ct__in=[ContentType.objects.get_for_model(model) in [FooModel, BarModel]])` 

3. Creation using a model class as a value:
`ModelWithContentTypeField.objects.create(ct=FooModel)`

Here's [https://github.com/sir-sigurd/django/tree/contenttype-field-3 rough implementation]."	New feature	new	contrib.contenttypes	dev	Normal			me@… Sage Abdullah	Someday/Maybe	0	0	0	0	0	0
