django/projects/uicloud/uicloud/management/addViewPermissions.py
def add_view_permissions():
    """
    This syncdb hooks takes care of adding a view permission too all our 
    content types.
    """
    # for each of our content types
    for content_type in ContentType.objects.all():
        # build our permission slug
        codename = "view_{}".format(content_type.model)

        # if it doesn't exist..
        if not Permission.objects.filter(content_type=content_type, codename=codename):
            # add it
            Permission.objects.create(content_type=content_type,
                                      codename=codename,
                                      name="Can view {}".format(content_type.name))
            print("Added view permission for {}".format(content_type.name))

    This syncdb hooks takes care of adding a view permission too all our 
    content types.
    
This syncdb hooks takes care of adding a view permission too all our
content types.
This syncdb hooks takes care of adding a view permission too all our content types .
def add_view_permissions():
    for content_type in ContentType.objects.all():
        codename = "view_{}".format(content_type.model)
        if not Permission.objects.filter(content_type=content_type, codename=codename):
            Permission.objects.create(content_type=content_type,
                                      codename=codename,
                                      name="Can view {}".format(content_type.name))
            print("Added view permission for {}".format(content_type.name))
def add_view_permissions ( ) : for content_type in ContentType . objects . all ( ) : codename = "view_{}" . format ( content_type . model ) if not Permission . objects . filter ( content_type = content_type , codename = codename ) : Permission . objects . create ( content_type = content_type , codename = codename , name = "Can view {}" . format ( content_type . name ) ) print ( "Added view permission for {}" . format ( content_type . name ) )
This syncdb hooks takes care of adding a view permission too all our
content types.
This syncdb hooks takes care of adding a view permission too all our content types .
"""
    This syncdb hooks takes care of adding a view permission too all our 
    content types.
    """ # for each of our content types # build our permission slug # if it doesn't exist.. # add it