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:06:34 -0400 |
| commit | 684a606a4ea21de6d1cc59b69f43b3a133672d59 (patch) | |
| tree | 61bdcc6a3ec4af7c1dae7773337bf6f10e98e634 /docs | |
| parent | b0953dc91385fb2823294a76d3c99e01c7b7e4ee (diff) | |
Fixed #20730 -- Fixed "Programmatically creating permissions" error.
Thanks glarrain for the report.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/auth/default.txt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index e2fa0c287e..9963ee518c 100644 --- a/docs/topics/auth/default.txt +++ b/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', content_type=content_type) |
