Skip to main content


Project description

# Duck Admin
A Django reusable app for show and operate custom forms in admin.

## Purpose

The Django Admin is great!
But it is highly depends on it's orm.

Data source not supported by Django's orm (e.g, redis, mongodb) can not show
in Django's admin site.

This app help you make your data (in redis, mongodb, file...) show in Django's Admin site.
Even you can operate with your data. (Add, Modify, Delete)

## Install

pip install duckadmin

## Usage

1. add `'duckadmin'` in `INSTALLED_APPS`
2. define your form. (you can place it in ``, ``, anywhere you like)

Demonstration ( more details see [example](/example/redisapp/ )
from duckadmin import DuckForm

# We define form (not model)
class MyRedisForm(DuckForm):
app_label = 'redisapp' # your app name
model_name = 'Person' # link url
verbose_name = 'Person' # name displayed in admin site
pk_name = 'id'

(1, 'male'),
(2, 'female'),

# fields defined below will show in admin site
id = forms.IntegerField()
name = forms.CharField(max_length=32)
gender = forms.ChoiceField(choices=GENDER)
age = forms.IntegerField()

# you should implement the api below:
# `request` is django request instance

def get_count(cls, request):
# get count of datasets
# return integer

def get_data(cls, request, start, stop):
# get all data to display in change list page
# return list of data.
# data is dict format, key is fields defined above

def get_data_by_pk(cls, request, pk):
# change form view

def create_data(cls, request, data):
# create new data

def update_data(cls, request, data):
# update an exist data

3. define admin. (in file ``)

from django.contrib import admin
from duckadmin import DuckAdmin
from redisapp.forms import MyRedisForm

class MyRedisAdmin(DuckAdmin):
duck_form = MyRedisForm


After this settings. you will see `Person` in admin site.


And the change list page


You can add, modify record


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

duckadmin-0.2.0.tar.gz (8.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page