From 1e4a9c0565c3d2f52ec205ae7627ebfc84278735 Mon Sep 17 00:00:00 2001 From: Alvin Li Date: Wed, 30 Oct 2013 10:16:21 +0800 Subject: * merged commits from 'maxwell lou' by time '20131028_09:52'; * moved 'ValueKind' model from 'recommend/models' to 'indicator/models' * added field 'type' for 'indicator.models.Indicator' * added field 'kind' for 'indicator.models.IndicatorRecord', 'InnateConfine' * updated methods for models 'Indicator', 'IndicatorRecord', 'InnateConfine' * updated views and templates for 'apps/indicator' * added 'INDICATOR_RECOMMEND_PERIOD' into 'settings.py' * added 'type' field for 'indicator.models.Indicator' in 'search_indexes.py' * added a confirm step for 'EditHistoryData' page when delete a record * removed dir 'backupdata'; 'queries.txt' moved to 'backup' dir * moved *.json to 'backup' dir * removed 'apps/managers*.py' * updated 'indicator/popup/IndexDesc.html' * created dir 'apps/indicator/obsolete'; * moved 'indicator/forms.py' to dir 'obsolete'; * splitted views related forms.py from 'views.py', and placed in 'obsolete/views_forms.py' * loadded newest data into database * cleaned pervious data files in 'backup' dir * updated 'README.txt'; added a solution to a redis problem * added field 'type' of 'indicator.models.Indicator'; for filtering search results and only returning 'NORMAL_TYPE' --- 97suifangqa/apps/sciblog/admin.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to '97suifangqa/apps/sciblog/admin.py') diff --git a/97suifangqa/apps/sciblog/admin.py b/97suifangqa/apps/sciblog/admin.py index 0dfb2ef..18a5490 100644 --- a/97suifangqa/apps/sciblog/admin.py +++ b/97suifangqa/apps/sciblog/admin.py @@ -2,7 +2,8 @@ from django.contrib import admin from django import forms from django.db import models -from .models import SciBlog, ResultContent, EndPoint +from .models import SciBlog, ResultContent, EndPoint, BlogAnnotation + from utils.widget import MarkitUpWidget, TinyMceWidget class ResultContentInline(admin.TabularInline): @@ -16,18 +17,35 @@ class SciBlogAdmin(admin.ModelAdmin): inlines = [ ResultContentInline, ] + filter_horizontal = ('hospital','konwledge_piece','endpoints','query') + def get_blogs(endp): - blog = endp.blogs.all()[0] - return "%s" % (blog.id, blog.title) + blogList = endp.blogs.all() + blogListWith3 = [] + for each in blogList: + blogListWith3.append('#'+str(each.id)) + #blogsStringWith3 = "#".join(blogListWith3) + + #return "%s" % (blog.id, blog.title) + + return blogListWith3 get_blogs.short_description = "SciBlog" -get_blogs.allow_tags = True +#get_blogs.allow_tags = True class EndPointAdmin(admin.ModelAdmin): - list_display = ('__unicode__', get_blogs) + #list_display = ('__unicode__', get_blogs) + list_display = ('__unicode__', 'type',get_blogs) + search_fields = ['content'] + + +class BlogAnnotationAdmin(admin.ModelAdmin): + list_display = ('__unicode__','no') + filter_horizontal = ('keywords',) admin.site.register(SciBlog, SciBlogAdmin) admin.site.register(EndPoint, EndPointAdmin) +admin.site.register(BlogAnnotation, BlogAnnotationAdmin) \ No newline at end of file -- cgit v1.2.2