Beispiel #1
0
def get_wall(page=u'1'):
    """ Returns activity for main wall, paginated."""
    activity_list = Activity.get_global_activity()
    paginator = Paginator(activity_list, 10)
    try:
        activity = paginator.page(page)
    except (EmptyPage, InvalidPage):
        activity = paginator.page(paginator.num_pages)
    return activity
Beispiel #2
0
def get_wall(page=u'1'):
    """ Returns activity for main wall, paginated."""
    activity_list = Activity.get_global_activity()
    paginator = Paginator(activity_list, 10)
    try:
        activity = paginator.page(page)
    except (EmptyPage, InvalidPage):
        activity = paginator.page(paginator.num_pages)
    return activity
Beispiel #3
0
def new_activity_messages(chat_user):
    """
    Return a list of new messages from the activity module, formatted the same as create_message.
    """
    query = Activity.get_global_activity().filter(timestamp__gt=chat_user.last_message_ts)
    msgs = []
    for m in query:
        message = u'<strong>%s</strong> %s' % (m.user_from.nickname, m.message)
        msgs.append(dict(room='global', text=message, time=m.timestamp.strftime("%H:%M"), mess_type='activity'))
    return msgs
Beispiel #4
0
def new_activity_messages(chat_user):
    """
    Return a list of new messages from the activity module, formatted the same as create_message.
    """
    query = Activity.get_global_activity().filter(timestamp__gt=chat_user.last_message_ts)
    msgs = []
    for m in query:
        message = u'<strong>%s</strong> %s' % (m.user_from.nickname, m.message)
        msgs.append(dict(room='global', text=message, time=m.timestamp.strftime("%H:%M"), mess_type='activity'))
    return msgs
Beispiel #5
0
def all_activity(request):
    """
     Render all public activity, no matter race or game
    """
    page = 1
    activity_list = Activity.get_global_activity(wouso_only=False)
    paginator = Paginator(activity_list, 100)
    try:
        activity = paginator.page(page)
    except (EmptyPage, InvalidPage):
        activity = paginator.page(paginator.num_pages)

    return render_to_response('activity/all.html', {'activity': activity}, context_instance=RequestContext(request))
Beispiel #6
0
def all_activity(request):
    """
     Render all public activity, no matter race or game
    """
    page = 1
    activity_list = Activity.get_global_activity(wouso_only=False)
    paginator = Paginator(activity_list, 100)
    try:
        activity = paginator.page(page)
    except (EmptyPage, InvalidPage):
        activity = paginator.page(paginator.num_pages)

    return render_to_response('activity/all.html', {'activity': activity}, context_instance=RequestContext(request))