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.4.tar.gz
.
File metadata
- Download URL: sqlalchemy-django-admin-0.0.4.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22a99b2eda4258e625128000a9304b0b3a2e13a47e938c66bdb3cf453109d0e9 |
|
MD5 | ee8f09302bfa6fc9c698e8d278bf4a2d |
|
BLAKE2b-256 | 9ef39a539feac5929fbb9d73d774b34e24f22340e6ed71d187b4aa5f58f65cec |
File details
Details for the file sqlalchemy_django_admin-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: sqlalchemy_django_admin-0.0.4-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.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dfa2f3e7523c41c289a83545d933dd1a483d79365e45259d43f83a1790a026b |
|
MD5 | 70ee0d733fe6a7363c71a50c2adfd86f |
|
BLAKE2b-256 | 077f3d4ca25b58e39e6e2751c0b03b18629f7ae0061141880ffac9b04d4a69a9 |