django-sortedm2m icon indicating copy to clipboard operation
django-sortedm2m copied to clipboard

Popup for creating new entity for relational field is not closing due to js error

Open fatalcoder opened this issue 4 years ago • 3 comments

Django 3.1 django-sortedm2m==3.0.2

Uncaught ReferenceError: windowname_to_id is not defined
    at window.<computed> (/static/sortedm2m/widget.js:105)
    at popup_response.js:13

Problematic call: https://github.com/jazzband/django-sortedm2m/blob/master/sortedm2m/static/sortedm2m/widget.js#L105

Related change on Django: https://github.com/django/django/commit/f982f0bdb8317e75af416595c616943d5025da1e

fatalcoder avatar Aug 17 '20 13:08 fatalcoder

Django 3.1 django-sortedm2m==3.0.2

Uncaught ReferenceError: windowname_to_id is not defined
    at window.<computed> (/static/sortedm2m/widget.js:105)
    at popup_response.js:13

Problematic call: https://github.com/jazzband/django-sortedm2m/blob/master/sortedm2m/static/sortedm2m/widget.js#L105

Related change on Django: django/django@f982f0b

Hey @fatalcoder, Did you find any workaround?

naumanarif21 avatar Nov 18 '20 06:11 naumanarif21

Hi, didn't search for any 'cause it's not a big deal for us. The values were updated, only the window didn't close.

You can always redefine the function that was removed from Django.

   function windowname_to_id(text) {	
        text = text.replace(/__dot__/g, '.');	
        text = text.replace(/__dash__/g, '-');	
        return text;	
    }

and even simplify it to just

function windowname_to_id(text) {		
        return text;	
    }

fatalcoder avatar Nov 18 '20 08:11 fatalcoder

Hi, im experiencing the same behavior but with a different JS error message: Screenshot from 2021-05-13 14-43-57 Plus the Delete check box is not showing: Screenshot from 2021-05-13 14-45-03

n3rio avatar May 13 '21 19:05 n3rio