diff options
Diffstat (limited to '97suifangqa/apps/sciblog/admin.py')
-rw-r--r-- | 97suifangqa/apps/sciblog/admin.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/97suifangqa/apps/sciblog/admin.py b/97suifangqa/apps/sciblog/admin.py new file mode 100644 index 0000000..0dfb2ef --- /dev/null +++ b/97suifangqa/apps/sciblog/admin.py @@ -0,0 +1,33 @@ +# -*- coding: utf8 -*- +from django.contrib import admin +from django import forms +from django.db import models +from .models import SciBlog, ResultContent, EndPoint +from utils.widget import MarkitUpWidget, TinyMceWidget + +class ResultContentInline(admin.TabularInline): + model = ResultContent + + +class SciBlogAdmin(admin.ModelAdmin): + #formfield_overrides = { + # models.TextField: {'widget': TinyMceWidget}, + #} + inlines = [ + ResultContentInline, + ] + +def get_blogs(endp): + blog = endp.blogs.all()[0] + return "<a href='/admin/sciblog/sciblog/%s'>%s<a>" % (blog.id, blog.title) + +get_blogs.short_description = "SciBlog" +get_blogs.allow_tags = True + +class EndPointAdmin(admin.ModelAdmin): + list_display = ('__unicode__', get_blogs) + + + +admin.site.register(SciBlog, SciBlogAdmin) +admin.site.register(EndPoint, EndPointAdmin) |