Gustavo Picon is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

tabo / django-treebeard

Efficient tree implementations for Django 1.0+ :: https://tabo.pe/projects/django-treebeard/

Clone this repository (size: 602.0 KB): HTTPS / SSH
hg clone https://bitbucket.org/tabo/django-treebeard
hg clone ssh://hg@bitbucket.org/tabo/django-treebeard
commit
0f2a87d336ee
parent
f45c785ede80
parent
b38bf3705bca
branch
1.6.X

merging from 1.61 tag to 1.6.X branch

1
f74c89ccdccb
import datetime
2
f74c89ccdccb
3
11d2c27832ed
from django.contrib import admin
4
2d621ff97f5b
from treebeard.admin import TreeAdmin
5
11d2c27832ed
6
11d2c27832ed
from tbexample.models import MP_Post, AL_Post, NS_Post
7
11d2c27832ed
8
11d2c27832ed
9
f74c89ccdccb
class TreeExampleAdmin(TreeAdmin):
10
f74c89ccdccb
    def save_form(self, request, form, change):
11
f74c89ccdccb
        if not change:
12
f74c89ccdccb
            form.cleaned_data['created'] = datetime.datetime.now()
13
f74c89ccdccb
        return form.save(commit=False)
14
f74c89ccdccb
15
f74c89ccdccb
16
f74c89ccdccb
class MP_Admin(TreeExampleAdmin):
17
11d2c27832ed
    pass
18
11d2c27832ed
19
11d2c27832ed
20
f74c89ccdccb
class AL_Admin(TreeExampleAdmin):
21
11d2c27832ed
    pass
22
11d2c27832ed
23
f74c89ccdccb
24
f74c89ccdccb
class NS_Admin(TreeExampleAdmin):
25
11d2c27832ed
    pass
26
11d2c27832ed
27
11d2c27832ed
28
11d2c27832ed
admin.site.register(MP_Post, MP_Admin)
29
11d2c27832ed
admin.site.register(AL_Post, AL_Admin)
30
11d2c27832ed
admin.site.register(NS_Post, NS_Admin)