1# all your import goes here for Models.py
2...
3
4# Adding Permissions to a Model.
5class BlogPost(models.Model):
6 ... # model fields
7 class Meta:
8 permissions = [('can_write_blog', 'Can Write Blog')]
9
10
11# Checking permissions in Views.py
12if request.user.has_perm('app_name.can_write_blog'):
13 # give access to blog post form
14else:
15 # restrict user from access the page.
16