Package: gino-admin
Gino-Admin(Unsupported, I don’t work on this library anymore right now - feel free to use & do anything if you want)Docs (state: in process):Gino-Admin docsPlay with Demo (current master 0.2.3)>>>> Gino-Admin demo <<<<(login: admin, pass: 1234)Admin Panel for PostgreSQL DB with Gino ORM and SanicHow to installpipinstallgino-admin==0.3.0How to useYou can find several code examples inexamples/folder.Supported featuresAuth by login/pass with cookie checkCreate(Add new) item by one for the ModelDelete all rows/per elementCopy existed element (data table row)Edit existed data (table row)Search/sort in tablesDeepcopy element (recursive copy all rows/objects that depend on chosen as ForeignKey)Upload/export data from/to CSVSQL-Runner (execute SQL-queries)Presets: Define order and Load to DB bunch of CSV-filesInit DB (Full clean up behavior: Drop tables & Recreate)Composite CSV: Load multiple relative tables in one CSV-fileHistory logs on changes (log for admin panel actions - edit, delete, add, init_db, load presets and etc)Support multiple users for Admin panel (add, edit, remove users from ‘Admin Users’ page)UI Colors customizingTODO:Add possible to add new Presets from GUISelect multiple rows for deleteCopy/deepcopy multiple itemsEdit multiple items (?)Roles for Admin Panel users (split accessess)Filters in Table’s columnsOther staff onGino Project DashboardSupported Data TypesJSONB, JSONTime, DateTime, DateBoolean, String, Decimal, Numeric, Float and etc.To see the full list of supported types take a look here:gino_admin/types.pyIf you don’t see type that you need - open the github issue with request and I will add ithttps://github.com/xnuinside/gino-admin/issues.
Or you can open PR by yourself and I will be glad to review it.How to run Gino-AdminRun with Cligino-adminrun#module_name_with_models -d postgresql://%(DB_USER):%(DB_PASSWORD)@%(DB_HOST):%(DB_PORT)/%(DB)gino-adminrun--help# use to get cli helpOptionalparams:-d--dbExpectedformat:postgresql://%(DB_USER):%(DB_PASSWORD)@%(DB_HOST):%(DB_PORT)/%(DB)Example:postgresql://gino:gino@%gino:5432/gino(basedonDBsettingsinexamples/)Notice:DBcredentialscanbesetupasenvvariableswith'SANIC_'prefix-h--host-p--port-c--configExample:-c"presets_folder=examples/base_example/src/csv_to_upload;some_property=1"Notice:allfieldsthatnotsupportedinconfigwillbeignored,like'some_property'inexample--no-authRunAdminPanelwithoutAuthinUI-u--userAdminUserlogin&passwordExpectedformat:login:passwordExample:admin:1234Notice:useralsocanbedefinedfromenvvariablewith'SANIC_'prefix-checkAuthsectionexampleExample:gino-adminrunexamples/run_from_cli/src/db.py--dbpostgresql://gino:gino@localhost:5432/gino-uadmin:1234Run Admin Panel as Standalone App (no matter that framework you use in main app)You can use Gino Admin as stand alone web app.
Does not matter what Framework used for your main App and that Gino Ext used to init Gino().Code example in:  examples/fastapi_as_main_app
How to run example in: examples/fastapi_as_main_app/how_to_run_example.txtYou need to createadmin.py(for example, you can use any name) to run admin panel:importosfromgino_adminimportcreate_admin_app# import module with your modelsimportmodels# gino admin uses Sanic as a framework, so you can define most params as environment variables with 'SANIC_' prefix# in example used this way to define DB credentials & login-password to admin panel# but you can use 'db_uri' in config to define creds for Database# check examples/colored_ui/src/app.py as exampleos.environ["SANIC_DB_HOST"]=os.getenv("DB_HOST","localhost")os.environ["SANIC_DB_DATABASE"]="gino"os.environ["SANIC_DB_USER"]="gino"os.environ["SANIC_DB_PASSWORD"]="gino"os.environ["SANIC_ADMIN_USER"]="admin"os.environ["SANIC_ADMIN_PASSWORD"]="1234"current_path=os.path.dirname(os.path.abspath(__file__))if__name__=="__main__":# host & port - will be used to up on them admin app# config - Gino Admin configuration - check docs to see all possible properties,# that allow set path to presets folder or custom_hash_method, optional parameter# db_models - list of db.Models classes (tables) that you want to see in Admin Panelcreate_admin_app(host="0.0.0.0",port=os.getenv("PORT",5000),db=models.db,db_models=[models.User,models.City,models.GiftCard,models.Country],config={"presets_folder":os.path.join(current_path,"csv_to_upload")},)All environment variables you can move to define in docker or .env files as you wish, they not needed to be define in ‘.py’, this is just for example shortness.Add Admin Panel to existed Sanic application as ‘/admin’ routeCreate in your project ‘admin.py’ file and useadd_admin_panelfrom from gino_admin import add_admin_panelCode example in:  examples/base_example
How to run example in: examples/base_example/how_to_run_example.txtExample:fromfromgino_adminimportadd_admin_panel# your app codeadd_admin_panel(app,db,[User,Place,City,GiftCard],custom_hash_method=custom_hash_method)Where:‘app’: your Sanic application‘db’ : from gino.ext.sanic import Gino; db = Gino() and[User, Place, City, GiftCard] - list of models that you want to add in Admin Panel to maintaincustom_hash_method - optional parameter to define you own hash method to encrypt all ‘_hash’ columns of your Models.In admin panel _hash fields will be displayed without ‘_hash’ prefix and fields values will be  hidden like ‘**‘PresetsLoad multiple CSV to DB in order by one click.
Presets described that CSV-s files and in that order need to be loaded in DB.Read the docs:PresetsComposite CSV to UploadComposite CSV - one file that contains data for several relative tables.Read the docs:Composite CSV to UploadConfig Gino AdminRead the docs:ConfigInit DBInit DB feature used for doing full clean up DB - it drop all tables & create them after Drop for all models in Admin Panel.Upload from CSVFiles-samples for example project can be found here:examples/base_example/src/csv_to_uploadAuthorizationRead in docs:AuthorizationLimitationsIn current version, for correct work of Deepcopy feature in Admin Panel model MUST contain at least one unique or primary_key Column (field).Screens:Check in docs:UI ScreensChangelogv0.3.0New Features:Added support for ‘hide_columns’ argument in admin panel configuration, example: examples/base_example/src/app.pyArgument removes those columns from admin panel ‘edit’ section.
You can pass column directly for one model, or global hide by name, for example:hide_columns = [ModelName.id, ‘pk’]This mean that for the model ModelName on ‘edit’ page column ‘id’ will be hided.
And globally for all models will be hided columns with name ‘pk’.ImprovementsDependencies was updatedv0.2.5Added favicon.icoUpdated Sanic version (by the way, I plan to move admin panel to FastAPI in next major release)Other dependencies also updatedFixed issue with stop admin panel serverv0.2.4Fixed issue with loop fromhttps://github.com/xnuinside/gino-admin/issues/37