Пример #1
0
def single_upload(request):
    posts = categories = pub_date = image = None
    config = lookup_settings(request)
    
    if config:
        blog = CMSUtility(config)
        categories = blog.get_categories()

        if request.method == 'POST':
            form = blog.form(request.POST, request.FILES)
            file_name = None
            if form.is_valid():
                blog.parse_form(form)
                blog.post_stories()
                posts = blog.get_links()
        else:
            form = blog.form()
            posts = pub_date = None
    else:
        posts = form = categories = pub_date = None
        
    return direct_to_template(request, 'single_upload.html', 
        {'config': config, 'categories': categories,
        'form': form, 'posts': posts, 'pub_date': pub_date, 
        'layout': 'default', })
Пример #2
0
def batch_upload_hierarchy(request):
    posts = form = categories = pub_date = rv_posts = None
    config = lookup_settings(request)

    if config:
        blog = CMSUtility(config)
        categories = blog.get_categories()

        if request.method == 'POST':
            form = blog.form(request.POST, request.FILES)
            file_name = None
            if form.is_valid():
                blog.parse_form(form, isZip=True, isHierarchy=True)
                blog.post_stories()
                posts = blog.get_links()

        else:
            form = blog.form()
            posts = None
    else:
        posts = form = categories = pub_date = None
        
    return direct_to_template(request, 'batch_upload_hierarchy.html', 
        {'config': config, 'categories': categories,
        'form': form, 'posts': posts, 'pub_date': pub_date, 
        'layouts': LAYOUTS, 'dir_structures': DIR_STRUCTURES, })