aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/recommend
diff options
context:
space:
mode:
authorAlvin Li <liweitianux@gmail.com>2013-10-04 23:56:35 +0800
committerAlvin Li <liweitianux@gmail.com>2013-10-04 23:56:35 +0800
commitf552b41f4b337e6844f71c29ff177915abbfa417 (patch)
tree7ade59430c6767a5b379c7a8cb95af3387622b13 /97suifangqa/apps/recommend
parent816730ff659e1338ab3e37a1d45ea337e337b3dd (diff)
download97dev-f552b41f4b337e6844f71c29ff177915abbfa417.tar.bz2
* indicator/static/javascripts/card_chart.js:
improved the display position of 'detail_card_info' * indicator/templates/indicator/SheetDefault.html: destroy 'qtip' when close card * added new app 'apps/sfaccount' * implemented 'signup' and 'activate' functions * implemented async sending activation mail (using 'django-celery' and 'redis') * moved 'registration/*' templates to 'sfaccount/templates' * implemented 'password_change' function: o password_change o password_change_done * implemented 'password_reset' function o password_reset o password_reset_done o password_reset_confirm o password_reset_complete o re-write 'sfaccount.fomrs.SFPasswordResetForm' o re-write 'sfaccount.views.password_reset_view' * improved 'sfaccount.functional' send mail functions o to send 'multipart' mail * added 'README.txt' * added app 'apps/recommend': for comparing with the SCI papers and then recommending most related papers for user.
Diffstat (limited to '97suifangqa/apps/recommend')
-rw-r--r--97suifangqa/apps/recommend/__init__.py0
-rw-r--r--97suifangqa/apps/recommend/models.py50
-rw-r--r--97suifangqa/apps/recommend/tests.py16
-rw-r--r--97suifangqa/apps/recommend/urls.py18
-rw-r--r--97suifangqa/apps/recommend/views.py17
5 files changed, 101 insertions, 0 deletions
diff --git a/97suifangqa/apps/recommend/__init__.py b/97suifangqa/apps/recommend/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/97suifangqa/apps/recommend/__init__.py
diff --git a/97suifangqa/apps/recommend/models.py b/97suifangqa/apps/recommend/models.py
new file mode 100644
index 0000000..98ae64d
--- /dev/null
+++ b/97suifangqa/apps/recommend/models.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+"""
+models for apps/recommend
+"""
+
+
+from django.db import models
+from django.contrib import admin
+
+
+class TreatRespnse(models.Model): # {{{
+ """
+ 治疗反应/结果的描述,以及结果的价值/权重
+ """
+ name = models.CharField(u"名称", max_length=100)
+ description = models.TextField(u"详细描述", blank=True)
+ weight = models.FloatField(u"权重", help_text=u"范围:0-10")
+ # datetime
+ created_at = models.DateTimeField(u"创建时间", auto_now_add=True)
+ updated_at = models.DateTimeField(u"更新时间",
+ auto_now_add=True, auto_now=True)
+
+ class Meta:
+ verbose_name_plural = u"治疗反应"
+
+ def __unicode__(self):
+ return u"< TreatRespnse: %s >" % self.name
+
+ def save(self, **kwargs):
+ if self.is_valid():
+ super(TreatRespnse, self).save(**kwargs)
+ else:
+ return self
+
+ def is_valid(self, **kwargs):
+ # check weight range
+ if (self.weight < 0.0) or (self.weight > 10.0):
+ print u"Error: weight < 0.0 / weight > 10.0"
+ return False
+ #
+ return True
+# }}}
+
+
+# admin
+admin.site.register([
+ TreatRespnse,
+])
+
diff --git a/97suifangqa/apps/recommend/tests.py b/97suifangqa/apps/recommend/tests.py
new file mode 100644
index 0000000..501deb7
--- /dev/null
+++ b/97suifangqa/apps/recommend/tests.py
@@ -0,0 +1,16 @@
+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.assertEqual(1 + 1, 2)
diff --git a/97suifangqa/apps/recommend/urls.py b/97suifangqa/apps/recommend/urls.py
new file mode 100644
index 0000000..09dfed4
--- /dev/null
+++ b/97suifangqa/apps/recommend/urls.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+
+"""
+URL configuration for apps/recommend
+"""
+
+from django.conf.urls.defaults import *
+
+from recommend import models as rm
+
+
+urlpatterns = patterns('recommend.views',
+ # app index
+ url(r'^$',
+ 'recommend_index',
+ name='recommend_index'),
+)
+
diff --git a/97suifangqa/apps/recommend/views.py b/97suifangqa/apps/recommend/views.py
new file mode 100644
index 0000000..02d5616
--- /dev/null
+++ b/97suifangqa/apps/recommend/views.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+
+"""
+views for apps/recommend
+"""
+
+from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, Http404
+from django.shortcuts import render, get_object_or_404
+
+
+# index
+def recommend_index(request):
+ """
+ index view for apps/recommend
+ """
+ return HttpResponse("recommend index")
+