Exemple #1
0
def get_current_person():
    user = get_current_user()
    if user is None:
        return None
    if not user.is_authenticated:
        return None
    return user
Exemple #2
0
def get_current_person():
    user = get_current_user()
    if user is None:
        return None
    if not user.is_authenticated():
        return None
    return user
Exemple #3
0
def log(user, object, flag, message):
    if user is None:
        user = get_current_user()
    if user is None:
        user_id = None
    else:
        user_id = user.pk
    LogEntry.objects.log_action(
        user_id         = user_id,
        content_type_id = ContentType.objects.get_for_model(object).pk,
        object_id       = object.pk,
        object_repr     = unicode(object),
        action_flag=flag,
        change_message=message)
Exemple #4
0
 def log_object(self, obj, flag, message, user=None):
     assert obj is not None
     assert obj.pk is not None
     if user is None:
         user = get_current_user()
     if user is None:
         user_id = None
     else:
         user_id = user.pk
     return self.log_action(
         user_id=user_id,
         content_type_id=ContentType.objects.get_for_model(obj).pk,
         object_id=obj.pk,
         object_repr=six.text_type(obj),
         action_flag=flag,
         change_message=message)
Exemple #5
0
 def log_object(self, obj, flag, message, user=None):
     assert obj is not None
     assert obj.pk is not None
     if user is None:
         user = get_current_user()
     if user is None:
         user_id = None
     else:
         user_id = user.pk
     return self.log_action(
         user_id=user_id,
         content_type_id=ContentType.objects.get_for_model(obj).pk,
         object_id=obj.pk,
         object_repr=six.text_type(obj),
         action_flag=flag,
         change_message=message)