aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/sciblog/models.py
diff options
context:
space:
mode:
authorAlvin Li <liweitianux@gmail.com>2013-08-21 07:55:06 +0800
committerAlvin Li <liweitianux@gmail.com>2013-08-21 07:55:06 +0800
commit3ef1e03e4273544cce177ce7fa0e0ab75eded990 (patch)
treebdce02e1e308dd040918de95ecce9b8254c3fc65 /97suifangqa/apps/sciblog/models.py
parent9d07e8a26657542c98535abb7812d83a98839918 (diff)
download97dev-3ef1e03e4273544cce177ce7fa0e0ab75eded990.tar.bz2
med 'indicator/static/javascripts/load_card.js' to 'card_chart.js
* set Highcharts global options in 'card_chart.js' * 'indicator/templates/indicator/SheetDefault.html': added js function 'chart_getdata_draw()' to draw chart for card * improved 'indicator.views.ajax_get_card_data_chart()' * implemented drawing chart for 'FLOAT_TYPE' and 'RANGE_TYPE' indicators * added datetime plugin 'momentjs': 'indicator/static/plugins/moment/', version 2.1.0 * 'indicator/templates/indicator/NewDeleteIndex.html': added link button to goto 'indicator_status' SheetDefault.html page * added option 'useHTML: true' for Highcharts; improved the display style of ylabels, if value >9999, then show in exponential notation * improved drawing of 'detail_chart', and the 'detail_card_info' * moved js global var to 'SheetDefault.html'; renamed var 'card_detail_id' to 'detail_card_id' * fixed js local variables problem; added 'var' keyword * added check of 'date' for 'indicator.models.IndicatorRecord' * ThickBox: removed param 'no1_title' from thickbox popup page's url placed the param 'card_id' before 'TB_iframe' * changed to use 'ANNOTATION_TYPES' for 'sciblog.models.BlogAnnotation' * improved 'indicator/templates/indicator/popup/IndexDesc.html' improved 'indicator.views.indicator_indexdesc()' * added 'sympy' to 'env/requirements.pip' TODO: * BlogAnnotation: 'get_absolute_url()' -> 'IndexDesc: go_library_btn' * detail_card_info: data table * Data input/edit form, and validate & submit * Highcharts xAxis labels problem ??
Diffstat (limited to '97suifangqa/apps/sciblog/models.py')
-rw-r--r--97suifangqa/apps/sciblog/models.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/97suifangqa/apps/sciblog/models.py b/97suifangqa/apps/sciblog/models.py
index d48ceca..d6a63d4 100644
--- a/97suifangqa/apps/sciblog/models.py
+++ b/97suifangqa/apps/sciblog/models.py
@@ -181,19 +181,30 @@ class BlogAnnotation(models.Model):
文章注释
'''
- type_choices = ((0, u"段落注释"),
- (1, u"专有名词"),)
-
- type = models.IntegerField(u"注释类型", choices=type_choices)
+ PARAGRAPH = 0
+ PROPER_NOUN = 1
+ ANNOTATION_TYPES = (
+ (PARAGRAPH, u"段落注释"),
+ (PROPER_NOUN, u"专有名词"),
+ )
+
+ type = models.IntegerField(u"注释类型", choices=ANNOTATION_TYPES)
no = models.IntegerField(u"编号", blank=True, null=True)
- brief_content = models.CharField(u"简短内容", max_length=400, blank= True)
+ brief_content = models.CharField(u"简短内容", max_length=400,
+ blank=True)
detail = models.TextField(u"详细内容", blank=True)
- blogs = models.ManyToManyField("SciBlog", verbose_name=u"文章", related_name="annotations", null=True, blank=True)
- keywords = models.ManyToManyField("info.KeyWord", verbose_name=u"关键词", related_name="annotations", null=True, blank=True)
- figures = models.ManyToManyField("figure.Figure", verbose_name=u"图片", related_name="annotations", null=True, blank=True)
- collected_by = models.ManyToManyField(User, verbose_name=u"收藏者", related_name="annotation_collection", null=True, blank=True)
+ blogs = models.ManyToManyField("SciBlog", verbose_name=u"文章",
+ related_name="annotations", null=True, blank=True)
+ keywords = models.ManyToManyField("info.KeyWord",
+ verbose_name=u"关键词", related_name="annotations",
+ null=True, blank=True)
+ figures = models.ManyToManyField("figure.Figure",
+ verbose_name=u"图片", related_name="annotations",
+ null=True, blank=True)
+ collected_by = models.ManyToManyField(User,
+ verbose_name=u"收藏者", related_name="annotation_collection",
+ null=True, blank=True)
objects = AnnotationManager()
-
class Meta:
verbose_name_plural = u"文章注释"
@@ -208,6 +219,10 @@ class BlogAnnotation(models.Model):
"""
return self.__unicode__()
+ def get_absolute_url(self):
+ # TODO
+ return ''
+
def firstkeyword(self):
u'''
第一个关键词,注意对于专有名词,通常只有一个
@@ -217,7 +232,8 @@ class BlogAnnotation(models.Model):
def firstparagraph(self):
u'''
- bloglist页面二上内容的阶段,django里面的注释第一段的末尾都是一个空格
+ bloglist页面二上内容的阶段,
+ django里面的注释第一段的末尾都是一个空格
'''
return self.detail.split(' ')[0]
@@ -227,7 +243,8 @@ class BlogAnnotation(models.Model):
'''
if user.is_authenticated() and user.annotation_collection.filter(id=self.id):
return True
- return False
+ else:
+ return False
# }}}