Handling MongoEngine's DynamicEmbeddedDocument in Flask-Admin Handling MongoEngine's DynamicEmbeddedDocument in Flask-Admin flask flask

Handling MongoEngine's DynamicEmbeddedDocument in Flask-Admin


It seems to me that you have to customise the admin-view for your models. It is a task that you have to do for your models if they are not displayed correctly "out of the box".

In most of the cases you don't have to fully rewrite the views. In most of the cases it will be enough to customise built-in views.

I don't have any experience developing for flask, but you will basically have to subclass ModelView. and register the subclass to the admin

#Customized admin viewsclass ExerciseQuestionView(ModelView): # # add customisation code here #class MultipleAnswerMCQExerciseQuestionView(ModelView): # # add customisation code here #class UniqueAnswerMCQExerciseQuestionView(ModelView): # # add customisation code here #if __name__ == '__main__':    # Create admin    admin = admin.Admin(app, 'Example: MongoEngine')    # Add admin views    admin.add_view(ExerciseQuestionView(ExerciseQuestion))    admin.add_view(MultipleAnswerMCQExerciseQuestionView(MultipleAnswerMCQExerciseQuestion))    admin.add_view(UniqueAnswerMCQExerciseQuestionView(UniqueAnswerMCQExerciseQuestion))    #...

Anyway i think you should go through the documentation... or you may end up waiting too long here...

http://flask-admin.readthedocs.io/en/latest/api/mod_contrib_mongoengine/


import timesentence = "ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ASK WHAT YOU CAN DO FOR YOUR COUNTRY"s = sentence.split() another = [0]time.sleep(0.5)print(sentence)    for count, i in enumerate(s):     if s.count(i) < 2:        another.append(max(another) + 1)    else:        another.append(s.index(i) +1)another.remove(0)time.sleep(0.5)print(another)file = open("N:\(Filedirectory)","w")file.write(another)  file.write(s)