Exemplo n.º 1
0
def to_transfer_single_issue(request, id):
    print("called the transfer function")
    rtn_dict = {"added": None, "id": id}
    try:
        comic = ComicFile.objects.get(pk=id)
        rtn_dict["comic"] = comic.name
    except Exception as e:
        rtn_dict["error_comic"] = e
    try:
        copy_file_to_transfer.delay(comic)
        rtn_dict["added"] = True
    except Exception as e:
        rtn_dict["error_celery"] = e
    return HttpResponse(json.dumps(rtn_dict), content_type="application/json")
Exemplo n.º 2
0
def transferPrimaries(request, series_id, unread=False):
    print("Calling transferPrimaries")
    rtn_dict = {}
    # primaries = PrimaryComics.objects.filter(series=series_id)
    primaries = ComicFile.objects.filter(primary=True, series=series_id)
    for issue in primaries:
        if unread:
            if issue.comic.read:
                rtn_dict[issue.id] = "Did not add a comic as it was already read - " + str(issue.id)
            else:
                copy_file_to_transfer.delay(issue)
                rtn_dict[issue.id] = "Adding unread comic to queue :: " + str(issue.id)
        else:
            copy_file_to_transfer.delay(issue)
            rtn_dict[issue.id] = "added to queue :: " + str(issue)
    print(rtn_dict)
    return HttpResponse(json.dumps(rtn_dict), content_type="application/json")
Exemplo n.º 3
0
def copy_to_transfer(modeladmin, request, queryset):
    for q in queryset:
        copy_file_to_transfer.delay(q)