示例#1
0
def create_event(user,
                 content_object,
                 event_content_object=None,
                 event_type=''):

    # log.debug('create_event - user: %s - content_object: %s - event_content_object: %s - event_type: %s' % (
    #     user,
    #     content_object,
    #     event_content_object,
    #     event_type,
    # ))

    Event.create_event(user, content_object, event_content_object, event_type)
    def greate_statistics(self):

        media_id = 13334
        num_entries = 500
        user_id = 1


        from datetime import datetime
        import random
        from random import randint
        from alibrary.models import Media
        from atracker.models import Event, EventType
        from django.contrib.auth.models import User

        print "test_relations"

        m = Media.objects.get(pk=media_id)

        for x in range(0, num_entries):


            try:
                et = EventType.objects.order_by('?').all()[0]
                #et = EventType.objects.get(title='stream')
                e = Event.create_event(user=User.objects.order_by('?').all()[0], content_object=m, event_type=et)
                year = random.choice(range(2013, 2015))
                month = random.choice(range(0, 13))
                day = random.choice(range(1, 28))
                hour = random.choice(range(0, 24))
                minute = random.choice(range(0, 60))
                second = random.choice(range(0, 60))
                e.created = datetime(year, month, day, hour, minute, second)
                e.save()
            except Exception, e:
                print e
                pass
示例#3
0
def create_event(user, content_object, event_content_object=None, event_type=''):

    Event.create_event(user, content_object, event_content_object, event_type)
示例#4
0
def create_event(user, content_object, event_content_object=None, event_type=''):
    log = logging.getLogger('atracker.util.create_event')
    log.info('adding event "%s" for "%s"' % (event_type, content_object))
    
    Event.create_event(user, content_object, event_content_object, event_type)