Ejemplo n.º 1
0
def upload(name, img_url, tags):
    picture = Picture()
    picture.name = name
    picture.img_url = img_url
    picture.tags = tags
    picture.save()
    return picture
Ejemplo n.º 2
0
def once_load_all():
    for str_tag in available_tags:
        for i in range(1, 21):
            snum = str(i)
            while len(snum) < 5:
                snum = '0' + snum

            picture = Picture()
            picture.name = snum + '-' + str_tag
            picture.img_url = '/' + snum + '-' + str_tag + '.jpg'
            picture.tags = [str_tag]
            picture.likes = random.randint(0, 666)

            picture.save()