diff options
| author | Tim Graham <timograham@gmail.com> | 2013-07-11 11:06:34 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-07-11 11:10:26 -0400 |
| commit | 288d70fccc802adabd2e20f14b3fe42591680cd4 (patch) | |
| tree | f9fc1ddd171076baa5fe86186e6f010d42596cda | |
| parent | e8971345b4bf0e7ce2124d033ee3385919f47309 (diff) | |
[1.4.x] Fixed #20730 -- Fixed "Programmatically creating permissions" error.
Thanks glarrain for the report.
Backport of 684a606a4e from master
| -rw-r--r-- | docs/topics/auth.txt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index 677429db47..23a4a0c762 100644 --- a/docs/topics/auth.txt +++ b/docs/topics/auth.txt @@ -1654,10 +1654,11 @@ While custom permissions can be defined within 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', content_type=content_type) |
