Coder Social home page Coder Social logo

Comments (3)

bashu avatar bashu commented on May 23, 2024

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.

bashu avatar bashu commented on May 23, 2024

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.

bashu avatar bashu commented on May 23, 2024

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.

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.