Esempio n. 1
0
def index(request):
    managers_networks = Manager.all().filter('is_network =', True)
    managers_direct_sale = Manager.all().filter('is_direct_sale =', True)
    managers_region_sale = Manager.all().filter('is_region_sale =', True)
    managers_collection = Manager.all().filter('is_collection =', True)
    manages_marketing = Manager.all().filter('is_marketing =', True)
    managers_it = Manager.all().filter('is_it =', True)
    presentation = AboutPage.all().get()
    if presentation:
        presentation = presentation.get_presentation_info()
    return render_to_response(
        'about/index.html',{
          'managers_networks': managers_networks,
          'managers_direct_sale': managers_direct_sale,
          'managers_region_sale': managers_region_sale,
          'managers_collection': managers_collection,
          'manages_marketing': manages_marketing,
          'managers_it': managers_it,
          'presentation': presentation
    })
Esempio n. 2
0
def change(request):
    url = blobstore.create_upload_url(url_for('about/admins/change'))
    obj = AboutPage.all().get()
    if obj:
        form = AboutPageForm(instance=obj, action=url)
    else:
        form = AboutPageForm(action=url)
    form.csrf_protected=False
    if request.method == 'POST' and form.validate(request.form):
        if obj:
            obj.delete_presentation()
        obj = form.save(commit=False)
        upload_files = get_uploads(request, 'presentation')
        if len(upload_files):
            blob_info = upload_files[0]
            if blob_info.size:
                obj.presentation = str(blob_info.key())
            else:
                blob_info.delete()
        obj.put()
        return redirect(url_for('admin/index'))

    return render_to_response('about/admins/change.html',
            {'form':form.as_widget()})