Comments (5)
The error seems to be from the ChoiceField or its subclass and there are no ChoiceFields mentioned in README. I've just entered this address to the form from one of my projects and it works fine ( http://pix.am/uMa8.png ).
Could you please provide more details? Are you using django admin? How is your 'address' field defined?
Original comment by: Mikhail Korobov
from django-easy-maps.
Yes, I'm trying to use it in the admin interface
Well, there's a property model related as defined
{{{
class Property(models.Model):
address=models.ForeignKey(Address)
....
}}}
and here's PropertyAdmin
{{{
class PropertyAdmin(admin.ModelAdmin):
list_display = ('ref', 'property_type', 'address', 'town', 'living_space', 'land_space', 'is_renting', 'price', 'published')
search_fields= ( 'is_renting', 'title', 'property_type', 'town', 'department', 'created_at')
date_hierarchy = 'created_at'
list_per_page=20
class form(forms.ModelForm):
class Meta:
widgets = {
'address': AddressWithMapWidget({'class': 'vTextField'})
}
}}}
Now, it appears that the address field puts the generated address id when i press [+] to add a new address.
How can I put the address not its id in the field ?
Thanks
Original comment by: Ahmed Youssef
from django-easy-maps.
It may be not clear from the readme, but address field should be CharField or TextField, not a ForeignKey to Address model.
Address model should be considered implementation detail. Its sole purpose is to avoid using geocoder for each request, that's a kind of persistent cache. Its description is included in readme only because it can be useful for custom map templates.
If text is changed in 'address' field then new Address instance will be auto-created on first map access.
Thanks for reporting this issue. I've just re-read the readme and it is indeed not clear what is 'address' field supposed to be.
Original comment by: Mikhail Korobov
from django-easy-maps.
Clarified readme. Fix #2.
→ <<cset 8ced16c04330>>
Original comment by: Mikhail Korobov
from django-easy-maps.
but how to use it as a foreign key, what would be the approach to have it as a property to another model?
Original comment by: Anonymous
from django-easy-maps.
Related Issues (20)
- 'NoneType' object has no attribute 'strip' HOT 1
- Entering an invalid address gives a Django error HOT 2
- Map with existing latitude/longitude HOT 8
- Upload failed (403): You are not allowed to edit 'django-easy-maps' package information HOT 1
- Upgrading to 9.0.2 gives an error on `migrate` HOT 1
- Driving directions?
- Update ``example`` project
- Assuming integer values for width/height HOT 7
- pip django-easy-map SyntaxError and Apps aren't loaded yet HOT 2
- Occassional failure to show maps even after successful geocoding HOT 1
- This page didn't load Google Maps correctly. See the JavaScript console for technical details. HOT 3
- Multiple API Inclusions / Modal Window HOT 3
- MissingKeyMapError HOT 1
- Error deploying app HOT 5
- initialize_map_1 is not a function HOT 8
- Compatibility problem with Django 3.0 HOT 2
- Package using to-be deprecated ugettext_lazy() HOT 1
- DeprecationWarning: using ABCs from 'collections' instead of from 'collections.abc' HOT 1
- Non-existent console.exception function call HOT 1
- The example is currently not working
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-easy-maps.