From 3f1d09f3b5b86157ccf9f47eef69a065be6153a4 Mon Sep 17 00:00:00 2001 From: Alvin Li Date: Thu, 22 Aug 2013 15:18:58 +0800 Subject: * added latest full package of 'jquery-ui' plugin, v1.10.3; * improved 'thickbox' plugin to use 'jquery-1.9.x'; * upgraded 'SheetDefault.html', 'NewDeleteIndex.html' and other pages to use 'jquery-1.9.x'; * improved 'IndexDesc.html' to deal with the problem of no related annotation found; * 'indicator.tools.get_record()' added param 'number', and updated the format of return data; * added 'get_num_record()' and 'get_num_record_std()' to 'indicator.tools'; * improved 'indicator.views.ajax_get_card_data_chart()', now can get data by 'num' or by 'date'; * improved 'indicator.views.ajax_get_card_data_table()', to provide the needed data requested from 'detail_card'; * improved js function 'chart_getdata_draw()' in 'SheetDefault.html'; * 'card_chart.js': renamed 'redraw_chart()' to 'detail_chart_getdata_draw()', and updated to get data by type; * updated 'table' of 'detail_card' in 'SheetDefault.html'; * improved js function 'get_card_data_table()' for providing and displaying record data in 'detail_card' table. TODO: * add/delete/edit record data --- 97suifangqa/apps/indicator/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to '97suifangqa/apps/indicator/models.py') diff --git a/97suifangqa/apps/indicator/models.py b/97suifangqa/apps/indicator/models.py index 1b35791..470165a 100644 --- a/97suifangqa/apps/indicator/models.py +++ b/97suifangqa/apps/indicator/models.py @@ -301,7 +301,7 @@ class IndicatorRecord(models.Model): # {{{ kwargs={'pk': self.id}) def save(self, **kwargs): - if self.is_valid() and self.check_confine: + if self.is_valid() and self.check_confine(): super(IndicatorRecord, self).save(**kwargs) else: raise ValueError(u'您输入的数据不符合要求') @@ -311,7 +311,7 @@ class IndicatorRecord(models.Model): # {{{ # check if exists record for the date qs = IndicatorRecord.objects.filter(indicator=self.indicator, date=self.date) - if qs: + if qs and qs[0].id != self.id: raise ValueError(u'date="%s" 该日期已经存在记录' % self.date) return False # check dataType @@ -484,6 +484,7 @@ class IndicatorRecord(models.Model): # {{{ val_min = None # output data data = { + 'id': self.id, 'date': self.date.isoformat(), 'value': value, 'val_max': val_max, @@ -495,6 +496,7 @@ class IndicatorRecord(models.Model): # {{{ } else: data = { + 'id': self.id, 'date': self.date.isoformat(), 'value': self.value, 'val_max': self.val_max, @@ -562,6 +564,7 @@ class IndicatorRecord(models.Model): # {{{ val_min_std = None # output data data_std = { + 'id': self.id, 'date': self.date.isoformat(), 'value': value_std, 'val_max': val_max_std, -- cgit v1.2.2