Beispiel #1
0
def update_activity_stream(sender, instance, **kwargs):
    # Used to update stream, not used by comments (see discuss.signals)

    try:  # check to make sure it's a published object
        activity_status = instance.status
    except:
        try:
            activity_status = instance.is_visible
        except:
            activity_status = False

    if activity_status:  # if published, check to make sure the object's corresponding activity doesn't already exist
        try:
            activity_check = ActivityStream.objects.get(
                content_type=ContentType.objects.get_for_model(instance),
                object_pk=instance.id)
        except:
            activity_check = False

        if not activity_check:
            activity = ActivityStream()
            activity.user = instance.user
            activity.created = datetime.datetime.now()
            activity.content_type = ContentType.objects.get_for_model(instance)
            activity.object_pk = instance.id
            activity.save()
Beispiel #2
0
def update_discuss_activity_stream(comment, request):
    from accounts.models import ActivityStream
    activity = ActivityStream()
    activity.user = comment.user
    activity.created = datetime.datetime.now()
    activity.content_type = ContentType.objects.get_for_model(ThreadedComment)
    activity.object_pk = comment.id
    activity.save()
Beispiel #3
0
def update_activity_stream(sender, instance, **kwargs):
    # Used to update stream, not used by comments (see discuss.signals)

    try:  # check to make sure it's a published object
        activity_status = instance.status
    except:
        try:
            activity_status = instance.is_visible
        except:
            activity_status = False

    if activity_status:  # if published, check to make sure the object's corresponding activity doesn't already exist
        try:
            activity_check = ActivityStream.objects.get(
                content_type=ContentType.objects.get_for_model(instance), object_pk=instance.id
            )
        except:
            activity_check = False

        if not activity_check:
            activity = ActivityStream()
            activity.user = instance.user
            activity.created = datetime.datetime.now()
            activity.content_type = ContentType.objects.get_for_model(instance)
            activity.object_pk = instance.id
            activity.save()
Beispiel #4
0
def update_discuss_activity_stream(comment, request):
    from accounts.models import ActivityStream
    activity = ActivityStream()
    activity.user = comment.user 
    activity.created = datetime.datetime.now()
    activity.content_type = ContentType.objects.get_for_model(ThreadedComment)
    activity.object_pk = comment.id
    activity.save()