(redirect=False)
return _outer
Decorate any location edit View with this, to warn user to not edit if a location upload is
        under process
    If redirect is set to True, user is redirected to current location import status page
Decorate any location edit View with this, to warn user to not edit if a location upload is
        under process
    If redirect is set to True, user is redirected to current location import status page
Decorate any location edit View with this to warn user to not edit if a location upload is under process If redirect is set to True user is redirected to current location import status page
def check_pending_locations_import(redirect=False):
    """
    Decorate any location edit View with this, to warn user to not edit if a location upload is
        under process
    If redirect is set to True, user is redirected to current location import status page
    """
    def _outer(view_fn):
        def new_fn(request, domain, *args, **kwargs):
            download_id = pending_location_import_download_id(domain)
            if download_id:
                status_url = reverse('location_import_status', args=[domain, download_id])
                if redirect:
                    # redirect to import status page
                    return HttpResponseRedirect(status_url)
                else:
                    warning_message = format_html(
                        _("Organizations can't be edited until the "
                          "<a href='{}'>current bulk upload</a> "
                          "has finished."),
                        status_url
                    )
                    messages.warning(request, warning_message)
                    return view_fn(request, domain, *args, **kwargs)
            else:
                return view_fn(request, domain, *args, **kwargs)
        return new_fn
    return _outer
def check_pending_locations_import ( redirect = False ) : def _outer ( view_fn ) : def new_fn ( request , domain , * args , * * kwargs ) : download_id = pending_location_import_download_id ( domain ) if download_id : status_url = reverse ( 'location_import_status' , args = [ domain , download_id ] ) if redirect : # redirect to import status page return HttpResponseRedirect ( status_url ) else : warning_message = format_html ( _ ( "Organizations can't be edited until the " "<a href='{}'>current bulk upload</a> " "has finished." ) , status_url ) messages . warning ( request , warning_message ) return view_fn ( request , domain , * args , * * kwargs ) else : return view_fn ( request , domain , * args , * * kwargs ) return new_fn return _outer