Пример #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)
Пример #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)
Пример #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)
Пример #4
0
def import_zipfile(zipfile):
    hierarchy = import_zip(zipfile)
    transaction.commit()
    return hierarchy
Пример #5
0
def import_zipfile(zipfile):
    with transaction.atomic():
        hierarchy = import_zip(zipfile)
    return hierarchy
Пример #6
0
def import_zipfile(zipfile):
    with transaction.atomic():
        hierarchy = import_zip(zipfile)
    return hierarchy