Django Admin for SQLAlchemy
Project description
Django Admin for SQLAlchemy
How to use it
- Install
pip install sqlalchemy-django-admin
- Add it to
INSTALLED_APPS
INSTALLED_APPS = [
...
'sqlalchemy_django_admin',
]
- Register table in admin
from django.contrib import admin
from sqlalchemy_django_admin import table_as_model
admin.site.register(table_as_model(your_sqlalchemy_table))
There's also the other ModelAdmin
with extra defined default behaviour.
from django.contrib import admin
from sqlalchemy_django_admin.admin import ModelAdmin
from sqlalchemy_django_admin import table_as_model
@admin.register(table_as_model(your_sqlalchemy_table))
class YourAdmin(ModelAdmin):
readonly_fields = ('field_x',)
Supported functions
TODO
Known issues
on_update
is not supported.- For tables without primary key you must define it explicitly while converting.
If there is no suitable unique column,
MultipleObjectsReturned
exception and other inconsistencies can occur. - Only small scope of SQLAlchemy's defaults is supported:
- Only nullable fields in admin forms are not required by default (
blank=True
). - Foreign keys work correctly only if there is exactly one foreign key on the given column.
- The lib was only tested for
types.DateTime(timezone=True)
and wasn't tested for naive datetimes. - Integrity errors that occur on db level are not caught and lead to 500.
- Now there is no way to define django fields on your own – they're always created automatically.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sqlalchemy-django-admin-0.0.5.tar.gz
.
File metadata
- Download URL: sqlalchemy-django-admin-0.0.5.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 506acff7b1eda61a6364f5bacc3b42cd3579ceab6ee90c414aad8879b4822343 |
|
MD5 | d0476452c46f8a1bf00f773ce7d293f4 |
|
BLAKE2b-256 | a994f5870b6710d8d4097b7df9565d7fef3d0686edea6d5efb0e0556558354ac |
File details
Details for the file sqlalchemy_django_admin-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: sqlalchemy_django_admin-0.0.5-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8144eb18f972cfae0628208d6d64aa1cb1b69c88c7c582eb6023a82d459caf77 |
|
MD5 | c1c6f521d9e0bad7e1d7edaed1d98fea |
|
BLAKE2b-256 | b9e626770fddd44adcf429a25fcde73f72187a8556c028d93bbb3df8ba5efb0c |