﻿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
20730	Error in docs / auth / Programmatically creating permissions	German Larrain	nobody	"In the example included in https://docs.djangoproject.com/en/dev/topics/auth/default/#programmatically-creating-permissions (versions 1.4, 1.5, and dev) there is a mistake in the sentence

{{{
content_type = ContentType.objects.get(app_label='myapp', model='BlogPost')
}}}

since that will raise

{{{
DoesNotExist: ContentType matching query does not exist.
}}}

since `model` argument must be in lower case. Thus the correct sentence would be

{{{
content_type = ContentType.objects.get(app_label='myapp', model='blogpost')
}}}

Perhaps an overall improvement would be to use method `get_for_model` of `ContentTypeManager` instead of `get` because it

  ""Returns the ContentType object for a given model, '''creating the ContentType if necessary'''. Lookups are cached so that '''subsequent lookups for the same model don't hit the database'''.""

In that case, the proposed solution is to replace the abovementioned sentence with:

{{{
from myapp.models import BlogPost
content_type = ContentType.objects.get_for_model(BlogPost)
}}}"	Bug	closed	Documentation	dev	Normal	fixed	permissions, content type		Accepted	1	0	0	0	1	0
