Example #1
0
def import_(request):
    if request.method == "GET":
        return {}
    file = request.FILES['file']
    zipfile = ZipFile(file)
    hierarchy = import_zip(zipfile)

    url = hierarchy.get_absolute_url()
    url = '/' + url.lstrip('/') # sigh
    return HttpResponseRedirect(url)
Example #2
0
def import_(request):
    if request.method == "GET":
        return render(request, "main/import.html", {})
    file = request.FILES["file"]
    zipfile = ZipFile(file)
    hierarchy = import_zip(zipfile)

    url = hierarchy.get_absolute_url()
    url = "/" + url.lstrip("/")  # sigh
    return HttpResponseRedirect(url)
Example #3
0
def import_(request):
    if request.method == "GET":
        return render(request, "main/import.html", {})
    file = request.FILES['file']
    zipfile = ZipFile(file)
    hierarchy = import_zip(zipfile)

    url = hierarchy.get_absolute_url()
    url = '/' + url.lstrip('/')  # sigh
    return HttpResponseRedirect(url)
Example #4
0
def import_zipfile(zipfile):
    hierarchy = import_zip(zipfile)
    transaction.commit()
    return hierarchy
Example #5
0
def import_zipfile(zipfile):
    with transaction.atomic():
        hierarchy = import_zip(zipfile)
    return hierarchy
Example #6
0
def import_zipfile(zipfile):
    with transaction.atomic():
        hierarchy = import_zip(zipfile)
    return hierarchy