Coder Social home page Coder Social logo

Comments (7)

mrjoes avatar mrjoes commented on July 2, 2024

Can you provide full exception text?

Or at least from the flask-admin?

from flask-admin.

mrjoes avatar mrjoes commented on July 2, 2024

OK, problem is in wtforms. It attempts to store default value and with new SQLAlchemy versions, it will be instance of the ColumnDefault class. Here's offending snippet::

    default = getattr(column, 'default', None)

    if default is not None:
        # Only actually change default if it has an attribute named
        # 'arg' that's callable.
        callable_default = getattr(default, 'arg', None)

        if callable_default and callable(callable_default):
            default = callable_default(None) 

I think I can override this logic, but I'm not sure what's safe way to do it.

from flask-admin.

guotie avatar guotie commented on July 2, 2024

File "E:\bin\Python27\lib\site-packages\flask\app.py", line 1518, in call
return self.wsgi_app(environ, start_response)
File "E:\bin\Python27\lib\site-packages\flask\app.py", line 1506, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "E:\bin\Python27\lib\site-packages\flask\app.py", line 1504, in wsgi_app
response = self.full_dispatch_request()
File "E:\bin\Python27\lib\site-packages\flask\app.py", line 1264, in full_dispatch_request
rv = self.handle_user_exception(e)
File "E:\bin\Python27\lib\site-packages\flask\app.py", line 1262, in full_dispatch_request
rv = self.dispatch_request()
File "E:\bin\Python27\lib\site-packages\flask\app.py", line 1248, in dispatch_request
return self.view_functionsrule.endpoint
File "E:\bin\Python27\lib\site-packages\flask_admin\base.py", line 36, in inner
return f(self, *_kwargs)
File "E:\bin\Python27\lib\site-packages\flask_admin\base.py", line 36, in inner
return f(self, *_kwargs)
File "E:\bin\Python27\lib\site-packages\flask_admin\base.py", line 36, in inner
return f(self, *_kwargs)
File "E:\bin\Python27\lib\site-packages\flask_admin\model\base.py", line 742, in create_view
return_url=return_url)
File "E:\bin\Python27\lib\site-packages\flask_admin\base.py", line 169, in render
return render_template(template, *_kwargs)
File "E:\bin\Python27\lib\site-packages\flask\templating.py", line 123, in render_template
context, ctx.app)
File "E:\bin\Python27\lib\site-packages\flask\templating.py", line 107, in _render
rv = template.render(context)
File "E:\bin\Python27\lib\site-packages\jinja2\environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "E:\bin\Python27\lib\site-packages\flask_admin\templates\admin\model\create.html", line 2, in top-level template code
{% import 'admin/lib.html' as lib with context %}
File "E:\bin\Python27\lib\site-packages\flask_admin\templates\admin\master.html", line 19, in top-level template code
{% block page_body %}
File "E:\bin\Python27\lib\site-packages\flask_admin\templates\admin\master.html", line 69, in block "page_body"
{% block body %}{% endblock %}
File "E:\bin\Python27\lib\site-packages\flask_admin\templates\admin\model\create.html", line 22, in block "body"
{{ lib.render_form(form, return_url, extra()) }}
File "E:\bin\Python27\lib\site-packages\flask_admin\templates\admin\lib.html", line 90, in template
{{ f() }}
File "E:\bin\Python27\lib\site-packages\wtforms\fields\core.py", line 136, in call
return self.widget(self, **kwargs)
File "E:\bin\Python27\lib\site-packages\wtforms\widgets\core.py", line 120, in call
kwargs['value'] = field._value()
File "E:\bin\Python27\lib\site-packages\wtforms\fields\core.py", line 539, in _value
return format % self.data
TypeError: a float is required

from flask-admin.

guotie avatar guotie commented on July 2, 2024

Thanks very much, flask-admin is very very very GREAT!

from flask-admin.

dantezhu avatar dantezhu commented on July 2, 2024

oh, no ,how to fix it?

from flask-admin.

mrjoes avatar mrjoes commented on July 2, 2024

This was, supposedly, fixed by https://github.com/mrjoes/flask-admin/issues/49

Reopened by accident.

from flask-admin.

dantezhu avatar dantezhu commented on July 2, 2024

@mrjoes thanks! It works!

from flask-admin.

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.