GithubHelp home page GithubHelp logo

Comments (4)

bradleyg avatar bradleyg commented on August 16, 2024 2

Should be fixed in the latest release.

from django-s3direct.

jwqian99 avatar jwqian99 commented on August 16, 2024 1

I encountered the same error using the latest (2.0.0) release, downgraded to 1.1.8 worked.

python 3.10, djanog 3.25, djang-s3direct 1.1.8

from django-s3direct.

WollenMoth avatar WollenMoth commented on August 16, 2024

Form page doesn't work either.

image

And I'm getting this error on the browser console.

image

from django-s3direct.

byteofwood avatar byteofwood commented on August 16, 2024

I think I discovered what is causing this issue. s3direct's script tag is inserted in the head. This means that this part of s3direct's script (the last ~150 chars of /static/s3direct/dist/index.js, prettified) is run before the page is fully loaded.

...
new MutationObserver((function(t) {
    [].forEach.call(document.querySelectorAll('.s3direct'), A)
}))
    .observe(document.body, {
        childList: !0,
        subtree: !0
    })

I believe document.body is null at the time it is run which causes the "parameter 1 is not of type 'Node'." I bodged this by putting the script at the end of the body by adding to the admin template. Info in this SO answer.

My /templates/admin/base_site.html file:

{% extends 'admin/base_site.html' %}
{% load static %}

{% block footer %}
    <div id="footer"></div>
    <script src="/static/s3direct/dist/index.js"></script>
{% endblock %}

This fixes the input not showing up problem for me. Hopefully there is a better way to solve this, perhaps jquery's .ready(), javascript's window.onload, or by somehow telling django to put the script at the end of the body (I'm not sure if this is possible using the Media class), or maybe even putting the script in the widget's template.

from django-s3direct.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.