Code Monkey home page Code Monkey logo

Comments (7)

asyncee avatar asyncee commented on June 11, 2024

Hello, thank you for your comment on this. I think the problem is that django admin updates select in background right after event happened (object created), but Select2-styled widget do not know about it.

So as a special case for django admin some callback should be there that will update Select2 widget with the new data.
I'll try to resolve the issue as soon as possible. Also, contributions are welcomed :)

from django-easy-select2.

ismaelbej avatar ismaelbej commented on June 11, 2024

For now I've overriden the javascript function dismissAddAnotherPopup from RelatedObjectLookups.js so that it also updates the select2 widget, but it is just an ugly hack.

Keep up the good work!

from django-easy-select2.

asyncee avatar asyncee commented on June 11, 2024

I think there is no other way than override RelatedObjectLookups.js. I will add custom js event after new object created, so it can be catched and appropriate Select2 widget updated.

Anyway, there should be new ModelAdmin class that overrides media property to load custom RelatedObjectLookups.js.

from django-easy-select2.

asyncee avatar asyncee commented on June 11, 2024

Fixed by extending dismissAddAnotherPopup function with custom javascript. No additional actions required after updating to this version. Could you please test it with https://github.com/asyncee/django-easy-select2/tree/issue-6 branch?

from django-easy-select2.

asyncee avatar asyncee commented on June 11, 2024

Hm, it is not working in Firefox.

from django-easy-select2.

ismaelbej avatar ismaelbej commented on June 11, 2024

I've tried your branch and it works with chromium! With firefox the hook was not begin called at all.

Changing this
function dismissAddAnotherPopup (win, newId, newRepr) {

to the following seems to work in both cromium and firefox
dismissAddAnotherPopup = function (win, newId, newRepr) {

Regards!

from django-easy-select2.

asyncee avatar asyncee commented on June 11, 2024

Merged. Version bumped to 1.2.4; pypi release updated. Thank you.

from django-easy-select2.

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.