(self, user, scope)
Returns the settings object for the given user and scope obj

        If scope is None, the settings for the user are returned
Returns the settings object for the given user and scope obj
Returns the settings object for the given user and scope obj
def get_for_scope(self, user, scope):
        """Returns the settings object for the given user and scope obj

        If scope is None, the settings for the user are returned"""
        if scope is None:
            content_type = None
            object_id = None
        else:
            content_type = ContentType.objects.get_for_model(scope)
            object_id = scope.pk

        try:
            return UserSettings.objects.get(
                user=user, content_type=content_type, object_id=object_id
            )

        except UserSettings.DoesNotExist:
            # if it does not exist, return a new instance. It is up to the
            # caller to save the object if required
            return UserSettings(
                user=user, content_type=content_type, object_id=object_id
            )
def get_for_scope ( self , user , scope ) : if scope is None : content_type = None object_id = None else : content_type = ContentType . objects . get_for_model ( scope ) object_id = scope . pk try : return UserSettings . objects . get ( user = user , content_type = content_type , object_id = object_id ) except UserSettings . DoesNotExist : # if it does not exist, return a new instance. It is up to the # caller to save the object if required return UserSettings ( user = user , content_type = content_type , object_id = object_id )