Skip to content
Browse files

[1.6.x] Fixed #20730 -- Fixed "Programmatically creating permissions"…

… error.

Thanks glarrain for the report.

Backport of 684a606 from master
  • Loading branch information...
1 parent f93b2fe commit fe0a563f812d9b05ef79ab89e0cb505b288b0d6a @timgraham timgraham committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 docs/topics/auth/default.txt
3 docs/topics/auth/default.txt
@@ -234,10 +234,11 @@ a model's ``Meta`` class, you can also create permissions directly. For
example, you can create the ``can_publish`` permission for a ``BlogPost`` model
in ``myapp``::
+ from myapp.models import BlogPost
from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType
- content_type = ContentType.objects.get(app_label='myapp', model='BlogPost')
+ content_type = ContentType.objects.get_for_model(BlogPost)
permission = Permission.objects.create(codename='can_publish',
name='Can Publish Posts',

0 comments on commit fe0a563

Please sign in to comment.
Something went wrong with that request. Please try again.