pallets-eco / flask-admin

Simple and extensible administrative interface framework for Flask
https://flask-admin.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5.79k stars 1.57k forks source link

form_ajax_refs in mongoengine #468

Closed bhanuvrat closed 10 years ago

bhanuvrat commented 10 years ago

I have some reference fields inside a list of embedded documents that I would like to fill with options ... but when I try and specify them it throws this error:

File "/home/aparashar/codefreak/project-awesomeness/env-awesomeness/lib/python2.7/site-packages/flask_admin/model/widgets.py", line 63, in __call__
    data = field.loader.format(field.data)
AttributeError: 'StringField' object has no attribute 'format'

Are form_ajax_refs not supported in mongoengine / embedded documents?

class CategoryMapView(ModelView):
    form_subdocuments = {
        'spec_map': {
            'form_subdocuments': {
                None: {
                    'form_columns': ('r42spec', 'ebayspec'),
                    'form_ajax_refs':{
                        'r42spec':(udaybabu.models.R42Specification.specname)    
                    }
                }
            }

        }
    }

Is it possible to make custom ajax loaders for mongoengine? Could you point me to some docs which explain the process. Thanks.

bhanuvrat commented 10 years ago

duplicate of #467 please remove.