Esempio n. 1
0
def add_extended_wallitem(wall,
                          author,
                          created_at=None,
                          template_name='default.html',
                          extra_context={}):

    # Default context variables for the wallitem
    context = Context({
        "wall": wall,
        "author": author,
    })

    context.update(extra_context)

    body = render_to_string('wallextend/%s' % template_name, context)

    try:
        # Create the standard WallItem
        wi = WallItem(wall=wall, body=body, author=author)
        if created_at:
            wi.created_at = created_at
        wi.save()
    except:
        pass
    else:
        #Success now create the extended item
        WallItemExtend(wallitem=wi, is_safe=True).save()
Esempio n. 2
0
def add_extended_wallitem( wall, author, created_at=None, template_name='default.html', extra_context={}):


        # Default context variables for the wallitem
        context = Context({
            "wall": wall,
            "author": author,
        })
        
        context.update(extra_context)

        body = render_to_string('wallextend/%s' % template_name, context) 
        
        try:
            # Create the standard WallItem
            wi = WallItem(wall=wall,body=body, author=author)
            if created_at:
                wi.created_at = created_at
            wi.save()
        except:
            pass
        else:
            #Success now create the extended item
            WallItemExtend(wallitem=wi,is_safe=True).save()