Giter VIP home page Giter VIP logo

Comments (9)

nemesifier avatar nemesifier commented on June 30, 2024 1

I do not have the time to investigate further.

Apprantly you rely on django-sortedm2m to have jQuery, that is a mistake.

I do not rely, it's the jquery-ui shipped in django-sortedm2m which expects a global jQuery.

At the moment the latest master of this package seems broken to me, I highly advise to not release it to pypi until the problem is fixed to avoid breaking existing applications that rely on it.

from django-sortedm2m.

amirouche avatar amirouche commented on June 30, 2024

The very first error comes from jquery-ui.js it is probably linked to the fact that there is several jquery.js or several jquery-ui.js that bring some trouble.

Can you change that line:

})(typeof jQuery === 'undefined' ? django.jQuery : jQuery);

And replace the ternary operation with simply django.jQuery?

Otherwise, if it does not work, you will need to provide an example code that reproduce the problem.

Have you tried the latest master in one of your applications?

Yes.

from django-sortedm2m.

nemesifier avatar nemesifier commented on June 30, 2024

@amirouche, that didn't work.

Reintroducing these lines which were removed fixes it: b8e8326#diff-1a1e3ea5b934607f6eeba01fbf28dff55ed43758ded45b83c1b89e44c26effa5L1-L3

In order to replicate the issue, these instructions can be followed:
https://github.com/openwisp/openwisp-controller#installing-for-development

Then, make sure the latest master of django-sortedm2m is installed in the virtual env.

Then, the error shows up in http://localhost:8000/admin/config/device/add/.
It does show up also in the edit page, although a device configuration (inline object) and some templates need to be created for the widget to show up.

from django-sortedm2m.

amirouche avatar amirouche commented on June 30, 2024

The lines removed were replaced by the ternary operator at the end, which seems to me like the correct idiom, that I picked up in Django or something like that.

In order to replicate the issue, these instructions can be followed:
https://github.com/openwisp/openwisp-controller#installing-for-development

Then, make sure the latest master of django-sortedm2m is installed in the virtual env.

I will look into this tomorrow.

from django-sortedm2m.

nemesifier avatar nemesifier commented on June 30, 2024

The lines removed were replaced by the ternary operator at the end, which seems to me like the correct idiom, that I picked up in Django or something like that.

Yes but jQuery ui expects to find a global jQuery object, which now is not available. Are you sure you're not getting the same issue in your application? If you're not seeing this issue, I suggest to double check if you don't have another line of JS somewhere defining a global jQuery object.

In the meanwhile I have opened #176, which I think it's the safest choice for maintaining backward compatibility and avoid problems in existing applications using this package.

from django-sortedm2m.

amirouche avatar amirouche commented on June 30, 2024

from django-sortedm2m.

nemesifier avatar nemesifier commented on June 30, 2024

Yes, I have another jQuery in the global namespace. I disagree with the backward compatibility thing. This is a bug, not a feature.

The solution used previously was not elegant but if we don't want to break the package we'll either have to find a better solution or rollback that change. I have not strong opinions, I only want this widget to keep working as it did in the last version.

from django-sortedm2m.

amirouche avatar amirouche commented on June 30, 2024

I do not have the time to investigate further.

Apprantly you rely on django-sortedm2m to have jQuery, that is a mistake.

from django-sortedm2m.

amirouche avatar amirouche commented on June 30, 2024

Sorry for the noise, I completely forgot sortedm2m rely on jqueryui!

Indeed #176 must be merged before a release.

from django-sortedm2m.

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.