aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/sciblog/admin.py
blob: 0dfb2ef9095711e22b2692435d51edefedd2c808 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)