Open spechtx opened 1 year ago
@spechtx Thanks for pointing this out. I am running into the same issue. Have you found a workaround in your case?
There's a warning about autocomplete_fields
implying custom widgets of their own in the django docs here: https://docs.djangoproject.com/en/4.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_overrides
I was not able to find a link with the issue mentioned here. My “workaround” is not to use autocomplete_fields
and AddressWidget on the same page.
IMHO, a solution here lies in the deprecation of the use of jquery
in this library, as described in https://github.com/furious-luke/django-address/issues/139.
I'm registering MyModel in the admin:
When autocomplete_fields is set, following error occurs: jquery.js:4050 jQuery.Deferred exception: self.geocomplete is not a function TypeError: self.geocomplete is not a function at HTMLInputElement. (http://127.0.0.1:8081/static/address/js/address.js:6:8)
at Function.each (http://127.0.0.1:8081/static/admin/js/vendor/jquery/jquery.js:385:19)
at jQuery.fn.init.each (http://127.0.0.1:8081/static/admin/js/vendor/jquery/jquery.js:207:17)
at HTMLDocument. (http://127.0.0.1:8081/static/address/js/address.js:2:21)
at mightThrow (http://127.0.0.1:8081/static/admin/js/vendor/jquery/jquery.js:3766:29)
at process (http://127.0.0.1:8081/static/admin/js/vendor/jquery/jquery.js:3834:12) undefined
jQuery.Deferred.exceptionHook @ jquery.js:4050
process @ jquery.js:3838
setTimeout (async)
(anonymous) @ jquery.js:3872
fire @ jquery.js:3500
fireWith @ jquery.js:3630
fire @ jquery.js:3638
fire @ jquery.js:3500
fireWith @ jquery.js:3630
ready @ jquery.js:4110
completed @ jquery.js:4120
jquery.js:4059 Uncaught TypeError: self.geocomplete is not a function
at HTMLInputElement. (address.js:6:8)
at Function.each (jquery.js:385:19)
at jQuery.fn.init.each (jquery.js:207:17)
at HTMLDocument. (address.js:2:21)
at mightThrow (jquery.js:3766:29)
at process (jquery.js:3834:12)
My guess is, the autocomplete field loads it's on jQuery for select2, and this somehow interferes...
Any idea for a workaround?