wilsaj / flask-admin-old Goto Github PK
View Code? Open in Web Editor NEWDeprecated Flask-Admin 0.x branch.
License: Other
Deprecated Flask-Admin 0.x branch.
License: Other
This is the code for the deprecated Flask-Admin 0.x branch. Flask-Admin 1.x is way better. Go check it out at: http://github.com/mrjoes/flask-admin
make html
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.1.3
loading pickled environment... done
Theme error:
no theme named 'flask_small' found (missing theme.conf?)
make: *** [html] Error 1
currently pretty bulky at ~25MB - there should be some old frameworky stuff that can be removed to slim things down
suppose there is a column which has a default value 0, like
upped = Column(Integer, default=0)
in Tweet model. It will display a column value with "ColumnDefault(0)" but not 0 in the "add new tweet page"
from flask.ext import admin
from flask.ext.admin.datastore.sqlalchemy import SQLAlchemyDatastore
from flask.ext.sqlalchemy import SQLAlchemy
i already install flask_admin.
Add a datastore class that works with MongoAlchemy (and Flask-MongoAlchemy) models.
The current code is directly tied to SQLAlchemy in a lot of places. One approach that should work well is to abstract out the stuff that Flask-Admin needs to ask of a datastore into some API that can be satisfied by a datastore object of some sort; then for any datastore, we just write objects that satisfy this API and we should be good.
to satisfy the passively curious
ability to work with flask-mongokit extension
add Chosen (http://harvesthq.github.com/chosen/) and replace crossSelect for multiple select. It's a really nice UI for select boxes that may or may not have lots of elements.
Whenever you define a field as primary_key it won't appear in the add/edit form. This behaviour can be modified by setting the exclude_pks to False on admin.datastore.sqlalchemy.SQLAlchemyDatastore.
This is ok for autoincremental Integer fields, but when you need a String as a primary_key this becomes a problem. Usually string primary keys are not sequential, and need to be edited while keeping sequential database-defined keys hidden.
A possible solution would be to split the exclude_pks parameter into editable_pks and editable_sequential_pks. That way you can achieve the expected behaviour by setting editable_pks=True and editable_sequential_pks=False.
It looks like we can not add/edit a REAL article(with style and photos) by flask-admin right now. Is it possible to fork it and add those functions?
Hi,
I found duplicated method name defined in flask_admin/__init__.py
https://github.com/wilsaj/flask-admin/blob/master/flask_admin/__init__.py#L558
IMO method name should be like conv_Time()
.
Regards.
needs to be
from flask import Flask, redirect
currently is
from flask import Flask
When the exclude_pks parameter is set to False in datastore.sqlalchemy.SQLAlchemyDatastore the following exception is thrown:
File "(...)python2.7/site-packages/flask_admin/datastore/sqlalchemy.py", line 250, in convert
not callable(default_value.arg):
AttributeError: 'Sequence' object has no attribute 'arg'
The Column is defined as follows:
pk = Column(Integer, Sequence('hash_pk'), primary_key=True)
This is the output from easy_install flask-admin using flask 0.8
Searching for flask-admin Reading http://pypi.python.org/simple/flask-admin/ Reading https://github.com/wilsaj/flask-admin/ Best match: Flask-Admin 0.3.0 Downloading http://pypi.python.org/packages/source/F/Flask-Admin/Flask-Admin-0.3 .0.tar.gz#md5=641c4caaa66aed3e15b67660d1e647d6 Processing Flask-Admin-0.3.0.tar.gz Running Flask-Admin-0.3.0\setup.py -q bdist_egg --dist-dir c:\users\abhishek\app data\local\temp\easy_install-5o9g6k\Flask-Admin-0.3.0\egg-dist-tmp-ehn5np Traceback (most recent call last): File "c:\Python27\Scripts\easy_install-script.py", line 8, in load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')() File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1712, in main with_ei_usage(lambda: File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1700, in with_ei_usage return f() File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1716, in distclass=DistributionWithoutHelpCommands, **kw File "c:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "c:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "c:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 211, in run self.easy_install(spec, not self.no_deps) File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 446, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 476, in install_item dists = self.install_eggs(spec, download, tmpdir) File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 655, in install_eggs return self.build_and_install(setup_script, setup_base) File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 930, in build_and_install self.run_setup(setup_script, setup_base, args) File "c:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 919, in run_setup run_setup(setup_script, args) File "c:\Python27\lib\site-packages\setuptools\sandbox.py", line 62, in run_se tup lambda: execfile( File "c:\Python27\lib\site-packages\setuptools\sandbox.py", line 105, in run return func() File "c:\Python27\lib\site-packages\setuptools\sandbox.py", line 64, in {'__file__':setup_script, '__name__':'__main__'} File "setup.py", line 50, in File "c:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "c:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "c:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "c:\Python27\lib\site-packages\setuptools\command\bdist_egg.py", line 167 , in run self.run_command("egg_info") File "c:\Python27\lib\distutils\cmd.py", line 326, in run_command self.distribution.run_command(command) File "c:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "c:\Python27\lib\site-packages\setuptools\command\egg_info.py", line 177, in run self.find_sources() File "c:\Python27\lib\site-packages\setuptools\command\egg_info.py", line 252, in find_sources mm.run() File "c:\Python27\lib\site-packages\setuptools\command\egg_info.py", line 308, in run self.read_template() File "c:\Python27\lib\site-packages\setuptools\command\sdist.py", line 157, in read_template _sdist.read_template(self) File "c:\Python27\lib\distutils\command\sdist.py", line 315, in read_template self.filelist.process_template_line(line) File "c:\Python27\lib\distutils\filelist.py", line 118, in process_template_li ne action, patterns, dir, dir_pattern = self._parse_template_line(line) File "c:\Python27\lib\distutils\filelist.py", line 97, in _parse_template_line dir = convert_path(words[1]) File "c:\Python27\lib\distutils\util.py", line 202, in convert_path raise ValueError, "path '%s' cannot end with '/'" % pathname ValueError: path 'flask_admin/' cannot end with '/'
In the docs it says model_key
but in the code it's model_url_key
.
Currently flask-admin is using the foreign model's name as the fields label/name in a model form:
line 530- line 533
return sa_fields.QuerySelectField(
foreign_model.name,
query_factory=_query_factory_for(foreign_model,
self.db_session),
allow_blank=local_column.nullable),
It seems to me that it is more intuitive to use relationship's name, rather than a models name,
ie: return sa_fields.QuerySelectField(
prop.key,
query_factory=_query_factory_for(foreign_model,
self.db_session),
allow_blank=local_column.nullable),
So adds and edits can be done on related items without leaving the page.
Example:
Teacher has a relationship on Student objects (one to many); we could add an "add a new <...>" button to pop up a student form that would create a new Student without leaving the Teacher edit/create page
Currently flask-admin is using the foreign model's name as the fields label/name in a model form:
line 530- line 533
return sa_fields.QuerySelectField(
foreign_model.name,
query_factory=_query_factory_for(foreign_model,
self.db_session),
allow_blank=local_column.nullable),
It seems to me that it is more intuitive to use relationship's name, rather than a models name,
ie: return sa_fields.QuerySelectField(
prop.key,
query_factory=_query_factory_for(foreign_model,
self.db_session),
allow_blank=local_column.nullable),
I installed bson 0.3.3 via pip.
Is that not the version you are using? Please add the correct version to setup.py.
from bson.errors import InvalidId
ImportError: No module named errors
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.