Skip to content

Conversation

@mapio
Copy link
Contributor

@mapio mapio commented May 7, 2013

This seems to fix the issue. Not sure it is the right way to go, though…

@rozza
Copy link
Contributor

rozza commented May 7, 2013

I still think that flask-admin shouldnt use text area for binary - probably a file upload instead.

@mapio
Copy link
Contributor Author

mapio commented May 7, 2013

This is a good point… I'll see if I'll be able to implement it and submit a pull-request.

@rozza
Copy link
Contributor

rozza commented May 7, 2013

Will merge if you can add a test case (so we dont regress) and use txt_type(valuelist[0]) instead :) 👍

@mapio
Copy link
Contributor Author

mapio commented May 7, 2013

I'm surely missing something: BinaryField does not appear at all in flask-admin code…

The "translation" between (mongo) BinaryField and (wtf) TextArea seems to happen in

@converts('BinaryField')

@mapio
Copy link
Contributor Author

mapio commented May 7, 2013

I believe it should be bin_type, not txt_type… am I wrong?

@rozza
Copy link
Contributor

rozza commented May 7, 2013

Re: Flask-admin I dont think it uses flask-mongoengine under the hood - so #46 will have to be fixed in their repo as well.

yes binary_type probably best :)

@mapio
Copy link
Contributor Author

mapio commented May 7, 2013

Test added (if you remove the wrapping with bin_type it fails).

And I don't think that flask-admin needs any fix in their repo: the testcase in #46 is based on flask-admin and works once this fix is applied (without touching flask-admin code).

rozza added a commit that referenced this pull request May 7, 2013
Ensure that BinaryFields are converted to `binary_type` (#48, #46)
@rozza rozza merged commit 05519b6 into MongoEngine:master May 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants