def add(request, entity): if (entity == 'Page'): obj = Page() elif (entity == 'Category'): obj = Category(name='') elif (entity == 'Picture'): obj = Picture() else: obj = Author() # TODO add the others, update the models obj.owner = users.get_current_user() return obj.edit(request)