Skip to main content

Django Admin for SQLAlchemy

Project description

Django Admin for SQLAlchemy

How to use it

  1. Install
pip install sqlalchemy-django-admin
  1. Add it to INSTALLED_APPS
INSTALLED_APPS = [
    ...
    'sqlalchemy_django_admin',
]
  1. 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

  1. on_update is not supported.
  2. 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.
  3. Only small scope of SQLAlchemy's defaults is supported:
  4. Only nullable fields in admin forms are not required by default (blank=True).
  5. Foreign keys work correctly only if there is exactly one foreign key on the given column.
  6. The lib was only tested for types.DateTime(timezone=True) and wasn't tested for naive datetimes.
  7. Integrity errors that occur on db level are not caught and lead to 500.
  8. Now there is no way to define django fields on your own – they're always created automatically.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy-django-admin-0.0.6.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

sqlalchemy_django_admin-0.0.6-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy-django-admin-0.0.6.tar.gz.

File metadata

File hashes

Hashes for sqlalchemy-django-admin-0.0.6.tar.gz
Algorithm Hash digest
SHA256 00e9a438c1ab03c15e4dc46ac17ea50e2ed33d66295531ec56835d62b9c1fc34
MD5 e694a6823d332477593539d5d567d187
BLAKE2b-256 7c25d31cbe57e378425da9a5b9fc6f239e984dc8bb1a3125e2584e0498a6ca72

See more details on using hashes here.

File details

Details for the file sqlalchemy_django_admin-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_django_admin-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 24c45526591a646e4141ea29dba4f9d89bdbf3977588a526617cd47182fb62f3
MD5 2e67ecc2feac5b4b3dbc6770aff7a8ae
BLAKE2b-256 ffc1cb180bdd67480a133fb7f891e573109c44492a1a1cd34777682cf7b03ceb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page