actionlog

Models

class LogEntry(*args, **kwargs)

A Entry in an object’s log.

action_type_short

Return a shortened, generalized version of an action type.

Useful for presenting an image signifying an action type. Example:

>>> print l.action_type

<NoticeType: project_component_added> >>> print l.action_type_short u’added’

message_safe()
Return the message as HTML
save(*args, **kwargs)
Save the object in the database.
action_logging(user, object_list, action_type, message=None, context=None)

Add ActionLog using a set of parameters.

user:
The user that did the action.
object_list:
A list of objects that should be created the actionlog for.
action_type:
Label of a type of action from the NoticeType model.
message:
A message to be included at the actionlog. If no message is passed it will try do render a message using the notice.html from the notification application.
context:
To render the message using the notification files, sometimes it is necessary to pass some vars by using a context.

Usage:

al = 'project_component_added'
context = {'component': object}
action_logging(request.user, [object], al , context=context):

Template Tags

class DoGetLog(tag_name)

Populates a template variable with the log for the given criteria.

Usage:

{% get_log <limit> as <varname> [for object <context_var_containing_user_obj>] %}

Examples:

{% get_log 10 as action_log for_object foo %}
{% get_log 10 as action_log for_user 23 %}
{% get_log 10 as action_log for_user current_user %}

Note that context_var_containing_user_obj can be a hard-coded integer (object ID) or the name of a template context variable containing the user object whose ID you want.