Package expedient :: Package common :: Package messaging :: Module models :: Class DatedMessageManager
[hide private]
[frames] | no frames]

Class DatedMessageManager

source code


Add some convenience functions for working with messages.

Instance Methods [hide private]
 
post_message_to_users(self, msg_text, sender=None, msg_type='announcement', **kwargs)
send a message to users matching the filter arguments in kwargs.
source code
 
post_message_to_user(self, msg_text, user, sender=None, msg_type='announcement')
send a message to a user
source code
 
delete_messages_for_user(self, msgs, user)
Delete messages for a user.
source code
 
get_messages_for_user(self, user)
Get messages for a particular user.
source code

Inherited from django.db.models.manager.Manager: __init__, aggregate, all, annotate, complex_filter, contribute_to_class, count, create, dates, db_manager, defer, distinct, exclude, exists, extra, filter, get, get_empty_query_set, get_or_create, get_query_set, in_bulk, iterator, latest, none, only, order_by, raw, reverse, select_related, update, using, values, values_list

Inherited from django.db.models.manager.Manager (private): _copy_to_model, _insert, _set_creation_counter, _update

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from django.db.models.manager.Manager: creation_counter

Properties [hide private]

Inherited from django.db.models.manager.Manager: db

Inherited from object: __class__

Method Details [hide private]

post_message_to_users(self, msg_text, sender=None, msg_type='announcement', **kwargs)

source code 

send a message to users matching the filter arguments in kwargs.

Parameters:
  • msg_text (string) - the text of the message
  • sender (django.contrib.auth.models.User) - the user sending the message. Default None.
  • msg_type (One of DatedMessage.TYPE_*) - the message type. One of DatedMessage.TYPE_* Defaults to DatedMessage.TYPE_ANNOUNCE
  • kwargs - filter arguments (e.g. username='dumbuser')

post_message_to_user(self, msg_text, user, sender=None, msg_type='announcement')

source code 

send a message to a user

Parameters:
  • msg_text (string) - the text of the message
  • user (django.contrib.auth.models.User or string) - the receiver of the message or her username
  • sender (django.contrib.auth.models.User) - the user sending the message. Default None.
  • msg_type (One of DatedMessage.TYPE_*) - the message type. One of DatedMessage.TYPE_* Defaults to DatedMessage.TYPE_ANNOUNCE

delete_messages_for_user(self, msgs, user)

source code 

Delete messages for a user.

Parameters:
  • msgs (iterable) - iterable of msgs to delete for user
  • user - user object whose messages to delete

get_messages_for_user(self, user)

source code 

Get messages for a particular user.

Parameters:
  • user - user object whose messages to get