File: admin.py

package info (click to toggle)
python-django-treebeard 4.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,160 kB
  • sloc: python: 5,010; makefile: 184
file content (18 lines) | stat: -rw-r--r-- 540 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import itertools

from django.contrib import admin
from treebeard.admin import admin_factory
from treebeard.forms import movenodeform_factory

from treebeard.tests.models import BASE_MODELS, UNICODE_MODELS, DEP_MODELS


def register(admin_site, model):
    form_class = movenodeform_factory(model)
    admin_class = admin_factory(form_class)
    admin_site.register(model, admin_class)


def register_all(admin_site=admin.site):
    for model in itertools.chain(BASE_MODELS, UNICODE_MODELS, DEP_MODELS):
        register(admin_site, model)