djangonauts / django-hstore

PostgreSQL HStore support for Django.
http://django-hstore.readthedocs.io/
Other
517 stars 142 forks source link

Question: DictionaryField in schema mode + ForeignKey? #87

Closed anatoly-scherbakov closed 9 years ago

anatoly-scherbakov commented 9 years ago

Is it possible to use ForeignKey type with DictionaryField in schema mode?

I am trying to do that as follows:

{
    "name": "testimonial_1_photo",
    "class": "ForeignKey",
    "kwargs": {
        "to": "filer.Image",
        "verbose_name": "Photo",
        "blank": true,
        "null": true
    }
}

I have the form for this model in Django-admin. When opening the page, it returns the following error:

ValueError: Cannot create form field for u'testimonial_1_photo' yet, because its related model u'filer.Image' has not been loaded yet

It seems that filer.Image path is not resolved to the actual model.

Actually I am trying to use django-filer reference fields with DictionaryField with a workaround that instructs django-hstore to accept them in schema. They do not work and I do not know why. But django-filer reference field is a subclass of ForeignKey, so trying to make ForegnKey working first.

nemesifier commented 9 years ago

@Altaisoft as written in the docs, only simple fields containing strings or numbers work out of the box, supporting more fields needs additional work

anatoly-scherbakov commented 9 years ago

Okay; I see. Thank you!