Invalid Literal error when adding a user permission to a Django user object
I've got a model defined in my Django app foo which looks like this: class Bar(models.Model): class Meta: permissions = ( ("view_bar", "Can view bars"), ) I've run manage.py syncdb on this, and sure enough, it shows up in the auth_permissions table: id|name|content_type_id|codename 41|Can view bars|12|view_bar However, when I try adding that permission to a user object in a view, like so: request.user.user_permissions.add('foo.view_bar') The code blows up with the following exception: invalid literal for int() with base 10: 'foo.view_bar' What's going on? user_permissions.add is adding to a