Comments (9)
The autocomplete on the example site in exampes/example_site
seems to be working properly. A typical cause for this kind of error is not including the geocomplete
JavaScript file. Did you use the form.media
method of including the JavaScript, or are you doing it manually?
from django-address.
I used form.media, and upon examining the HTML source I see this in the
head:
<script src="
https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="
https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false
"></script>
<script type="text/javascript"
src="/static/address/js/jquery.geocomplete.js"></script>
<script type="text/javascript"
src="/static/address/js/address.js"></script> <!-- needed for JS/GoogleMaps
lookup -->```
However I am also already including Jquery at the bottom of my body. Could
this be interfering?
On Fri, Jan 8, 2016 at 3:34 PM, Luke Hodkinson <[email protected]>
wrote:
> The autocomplete on the example site in exampes/example_site seems to be
> working properly. A typical cause for this kind of error is not including
> the geocomplete JavaScript file. Did you use the form.media method of
> including the JavaScript, or are you doing it manually?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/furious-luke/django-address/issues/33#issuecomment-170134094>
> .
>
from django-address.
Yea as soon as I move this below to the bottom of the body, below where I
import my own JQuery (1.x) it works.
On Fri, Jan 8, 2016 at 5:10 PM, John Lehmann [email protected] wrote:
I used form.media, and upon examining the HTML source I see this in the
head:<script src=" https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js "></script> <script type="text/javascript" src="/static/js/jquery.min.js"></script> <script type="text/javascript" src=" https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false "></script> <script type="text/javascript" src="/static/address/js/jquery.geocomplete.js"></script> <script type="text/javascript" src="/static/address/js/address.js"></script> <!-- needed for JS/GoogleMaps lookup -->``` However I am also already including Jquery at the bottom of my body. Could this be interfering? On Fri, Jan 8, 2016 at 3:34 PM, Luke Hodkinson <[email protected]> wrote: > The autocomplete on the example site in exampes/example_site seems to be > working properly. A typical cause for this kind of error is not including > the geocomplete JavaScript file. Did you use the form.media method of > including the JavaScript, or are you doing it manually? > > — > Reply to this email directly or view it on GitHub > <https://github.com/furious-luke/django-address/issues/33#issuecomment-170134094> > . >
from django-address.
Okay, no problems. I'll add a section to the documentation about using your own jQuery.
from django-address.
Hi Luke, you might answer this in your docs about custom JQuery, but here's where I'm currently stuck at: I am using JQuery version 1.11.3 just for maximum compatibility across devices etc. This gets run first. I then run Bootstrap's JQuery plugin. Finally I include django-address media tag, which brings in:
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
<script type="text/javascript" src="/static/address/js/jquery.geocomplete.js"></script>
<script type="text/javascript" src="/static/address/js/address.js"></script>
It appears to be running a local version of JQuery which its installed in my static path. (Note I didn't even include the explicit call to JQuery 2 which your dev-branch only docs show).
The net effect is I get some errors from later calls to the Bootstrap plugin (popover and collapse) which are not known. Clearly this is caused somehow by multiple JQuery versions, but I don't have a lot of depth here.
Questions:
- Many of your users will already have JQuery so do you want to include it by default as you are doing or does it make more sense to have them include it explicitly like your docs showed in the dev branch?
- Would django-address and its dependencies work properly with JQuery 1.x? I am happy to test that out.
from django-address.
The media
approach to including JavaScript is useful for basic needs, but if you wish to include your own versions of plugins you'll need to include all the JavaScript manually, not using media
.
I've not tested against jQuery 1.x, it really comes down to whether jquery.geocomplete
can handle it. Certainly the django-address
JavaSript would be fine with jQuery 1.x, as it's nothing more than a simple function call.
from django-address.
Ah ya, that is obvious I guess. Works perfectly (don't see a problem with
1.x). Thanks!
On Sun, Jan 10, 2016 at 4:33 PM, Luke Hodkinson [email protected]
wrote:
The media approach to including JavaScript is useful for basic needs, but
if you wish to include your own versions of plugins you'll need to include
all the JavaScript manually, not using media.I've not tested against jQuery 1.x, it really comes down to whether
jquery.geocomplete can handle it. Certainly the django-address JavaSript
would be fine with jQuery 1.x, as it's nothing more than a simple function
call.—
Reply to this email directly or view it on GitHub
#33 (comment)
.
from django-address.
I'll let you close this once you add whatever documentation you wanted to.
from django-address.
I'm going to close this, since this is very old and I do not know if we will want to require jquery in 0.3.0.
from django-address.
Related Issues (20)
- Add end-to-end tests
- Use Docker for example site HOT 2
- Admin does not query google HOT 2
- default Autofield and django 3.2
- Update translation to Django 4 HOT 1
- Nonexistent parent node ('address', '004_auto_20220227_1259') HOT 16
- Include serializers for usage inside rest framework HOT 2
- Error installing version 0.2.7 due to incorrect metadata HOT 1
- Python3.9 integration HOT 2
- Address save via admin saves the primary key into raw column, and additionally creates a bare new object HOT 3
- unique=True HOT 2
- Error when using together with Django autocomplete fields in admin HOT 3
- {{ form.media }} seems to render nothing in Django 4 HOT 2
- Address Form field only populates if full address is provided.
- Fill related models upon Address creation.
- Support for model serializer with django-rest-framework HOT 4
- Add documentation to readthedocs
- Prefer django_countries.fields.CountryField instead of implement address.models.Country
- AddressField on admin site
- Cant select address without `address_street_number`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-address.