(user, project, owner=None)
return access
Returns True if a user has write access to an instance
Returns True if a user has write access to an instance
Returns True if a user has write access to an instance
def is_writable(user, project, owner=None):
    """
    Returns True if a user has write access to an instance
    """

    # Anonymous user may not have write access.
    if not user or user.is_anonymous:
        return False

    # Users that may access a project.
    cond1 = user.is_staff or user.is_superuser

    # User has been given write access to the project
    cond2 = models.Access.objects.filter(user=user, project=project,
                                         access=models.Access.WRITE_ACCESS).first()

    # User owns this project.
    owner = owner or project.owner
    cond3 = user == owner

    # One of the conditions has to be true.
    access = cond1 or cond2 or cond3

    return access
def is_writable ( user , project , owner = None ) : # Anonymous user may not have write access. if not user or user . is_anonymous : return False # Users that may access a project. cond1 = user . is_staff or user . is_superuser # User has been given write access to the project cond2 = models . Access . objects . filter ( user = user , project = project , access = models . Access . WRITE_ACCESS ) . first ( ) # User owns this project. owner = owner or project . owner cond3 = user == owner # One of the conditions has to be true. access = cond1 or cond2 or cond3 return access