Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #20730 -- Fixed "Programmatically creating permissions" error.

Thanks glarrain for the report.
  • Loading branch information...
commit 684a606a4ea21de6d1cc59b69f43b3a133672d59 1 parent b0953dc
Tim Graham authored July 11, 2013

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  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
234 234
 example, you can create the ``can_publish`` permission for a ``BlogPost`` model
235 235
 in ``myapp``::
236 236
 
  237
+    from myapp.models import BlogPost
237 238
     from django.contrib.auth.models import Group, Permission
238 239
     from django.contrib.contenttypes.models import ContentType
239 240
 
240  
-    content_type = ContentType.objects.get(app_label='myapp', model='BlogPost')
  241
+    content_type = ContentType.objects.get_for_model(BlogPost)
241 242
     permission = Permission.objects.create(codename='can_publish',
242 243
                                            name='Can Publish Posts',
243 244
                                            content_type=content_type)

0 notes on commit 684a606

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