aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/info
diff options
context:
space:
mode:
authorAlvin Li <liweitianux@gmail.com>2013-08-13 14:13:24 +0800
committerAlvin Li <liweitianux@gmail.com>2013-08-13 14:13:24 +0800
commit9636d4a6767f49384d5c386bc3f1142c88b90613 (patch)
tree3a70f6d9e4be1791d36c87cc7cbfd1d5aa2b39dd /97suifangqa/apps/info
parent9383d9a8a5988d071766c3d08a5c946e9c5b02ae (diff)
download97dev-9636d4a6767f49384d5c386bc3f1142c88b90613.tar.bz2
cloned from 'bitbucket', 2013/08/13
Diffstat (limited to '97suifangqa/apps/info')
-rw-r--r--97suifangqa/apps/info/__init__.py0
-rw-r--r--97suifangqa/apps/info/fixtures/initial_data.json1094
-rw-r--r--97suifangqa/apps/info/forms.py23
-rw-r--r--97suifangqa/apps/info/models.py119
-rw-r--r--97suifangqa/apps/info/search_indexes.py15
-rw-r--r--97suifangqa/apps/info/tests.py16
-rw-r--r--97suifangqa/apps/info/utils.py8
-rw-r--r--97suifangqa/apps/info/views.py32
8 files changed, 1307 insertions, 0 deletions
diff --git a/97suifangqa/apps/info/__init__.py b/97suifangqa/apps/info/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/97suifangqa/apps/info/__init__.py
diff --git a/97suifangqa/apps/info/fixtures/initial_data.json b/97suifangqa/apps/info/fixtures/initial_data.json
new file mode 100644
index 0000000..9d5a811
--- /dev/null
+++ b/97suifangqa/apps/info/fixtures/initial_data.json
@@ -0,0 +1,1094 @@
+[
+ {
+ "pk": 1,
+ "model": "info.keyword",
+ "fields": {
+ "standard_judge": false,
+ "created_at": "2013-06-08T13:41:51.053",
+ "object_id": null,
+ "content": "\u8c37\u4e19\u8f6c\u6c28\u9176",
+ "user": null,
+ "content_type": null,
+ "categoryid": null,
+ "description": ""
+ }
+ },
+ {
+ "pk": 2,
+ "model": "info.keyword",
+ "fields": {
+ "standard_judge": false,
+ "created_at": "2013-06-12T00:46:54.790",
+ "object_id": null,
+ "content": "\u8868\u9762\u6297\u539f",
+ "user": null,
+ "content_type": null,
+ "categoryid": null,
+ "description": ""
+ }
+ },
+ {
+ "pk": 1,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.684",
+ "object_id": null,
+ "content": "\u5982\u4f55\u53bb\u5b9a\u4e49\u4e59\u809d\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 2,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.754",
+ "object_id": null,
+ "content": "\u4ec0\u4e48\u662f\u6162\u6027\u4e59\u578b\u809d\u708e\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 3,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.775",
+ "object_id": null,
+ "content": "\u4ec0\u4e48\u662f\u6025\u6027\u4e59\u578b\u809d\u708e\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 4,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.797",
+ "object_id": null,
+ "content": "\u5c0f\u4e09\u9633\u7684\u4e59\u809d\u75c5\u72b6\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 5,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.823",
+ "object_id": null,
+ "content": "\u5c0f\u4e09\u9633\u7684\u4e59\u809d\u4e3a\u4f55\u4f1a\u6bd4\u5927\u4e09\u9633\u96be\u4ee5\u6cbb\u6108\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 6,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.852",
+ "object_id": null,
+ "content": "\u4ec0\u4e48\u662f\u4e59\u809d\uff1f\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 7,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.872",
+ "object_id": null,
+ "content": "\u5c0f\u4e09\u9633\u2019\u8f6c\u5316\u6210\u2018\u5c0f\u4e8c\u9633\u2019\u4ee3\u8868\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 8,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.893",
+ "object_id": null,
+ "content": "\u5c0f\u4e09\u9633\u2019\u7684\u4e59\u809d\u75c5\u539f\u5b66\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 9,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.917",
+ "object_id": null,
+ "content": "\u6bcd\u5a74\u4f20\u64ad\u7a76\u7adf\u662f\u600e\u6837\u7684\u5f62\u5f0f\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 10,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.943",
+ "object_id": null,
+ "content": "\u6bcd\u4eb2\u6216\u7236\u4eb2\u5f97\u4e86\u809d\u708e\u662f\u5426\u80fd\u8981\u5c0f\u5b69\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 11,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.964",
+ "object_id": null,
+ "content": "\u82e5\u662f\u4e59\u809d\u60a3\u8005\uff0c\u8fdb\u884c\u6000\u5b55\u7684\u8fc7\u7a0b\u4e2d\u9700\u8981\u6ce8\u610f\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 12,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:12.987",
+ "object_id": null,
+ "content": "\u82e5\u662f\u610f\u5916\u6000\u5b55\uff0c\u4f55\u79cd\u60c5\u51b5\u53ef\u4ee5\u4e0d\u5fc5\u6d41\u4ea7 \n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 13,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.009",
+ "object_id": null,
+ "content": "\u4ea7\u524d\u4ea7\u4e2d\u4ea7\u540e\u9700\u8981\u6ce8\u610f\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 14,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.046",
+ "object_id": null,
+ "content": "\u4ea7\u540e\u9700\u8981\u4f55\u79cd\u65b9\u5f0f\u4fdd\u62a4\u65b0\u751f\u513f\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 15,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.065",
+ "object_id": null,
+ "content": "\u5404\u9879\u6307\u6807\u4ee3\u8868\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 16,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.092",
+ "object_id": null,
+ "content": "\u4e24\u5bf9\u534a\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 17,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.121",
+ "object_id": null,
+ "content": "\u7532\u80ce\u86cb\u767d\u662f\u4ec0\u4e48\uff1f\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 18,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.144",
+ "object_id": null,
+ "content": "\u8c37\u4e19\u8f6c\u6c28\u9176\u662f\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 19,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.165",
+ "object_id": null,
+ "content": "\u4ec0\u4e48\u662f\u75c5\u6bd2HBV DNA\uff1f\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 20,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.185",
+ "object_id": null,
+ "content": "\u2018\u5927\u4e09\u9633\u2019\u4ee3\u8868\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 21,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.213",
+ "object_id": null,
+ "content": "\u5c0f\u4e09\u9633\u4ee3\u8868\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 22,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.236",
+ "object_id": null,
+ "content": "\u2018\u5c0f\u4e8c\u9633\u2019\u7684\u6982\u5ff5\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 23,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.256",
+ "object_id": null,
+ "content": "\u76ee\u524d\u533b\u9662\u4f1a\u91c7\u53d6\u54ea\u4e9b\u68c0\u6d4b\u624b\u6bb5\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 24,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.278",
+ "object_id": null,
+ "content": "\u533b\u9662\u5728\u68c0\u6d4b\u4e59\u809d\u60a3\u8005\u662f\u4f1a\u91c7\u53d6\u4f55\u79cd\u68c0\u6d4b\u65b9\u6848\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 25,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.298",
+ "object_id": null,
+ "content": "\u6bcf\u4e00\u79cd\u68c0\u6d4b\u65b9\u6848\u6240\u4ee3\u8868\u7684\u610f\u4e49\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 26,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.319",
+ "object_id": null,
+ "content": "\u5728\u7ed3\u5408\u6307\u6807\u60c5\u51b5\u4e0b\u63a8\u9009\u4f55\u79cd\u5408\u9002\u65f6\u671f \n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 27,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.344",
+ "object_id": null,
+ "content": "\u7ed3\u5408\u6307\u6807\u4ee5\u53ca\u7528\u836f\u5386\u53f2\u8fdb\u884c\u5408\u7406\u7684\u89e3\u91ca \n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 28,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.367",
+ "object_id": null,
+ "content": "\u8fdb\u884c\u4f55\u79cd\u5176\u4ed6\u65b9\u9762\u7684\u68c0\u6d4b\uff1f \n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 29,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.419",
+ "object_id": null,
+ "content": "\u5728\u8fdb\u884c\u4e86\u5e38\u89c4\u68c0\u6d4b\u540e\uff0c\u4e3a\u4f55\u533b\u751f\u8fd8\u4f1a\u5efa\u8bae\u53bb\u505a\u5176\u4ed6\u65b9\u9762\u7684\u68c0\u6d4b\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 30,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.440",
+ "object_id": null,
+ "content": "\u4e3a\u4f55\u8fd9\u79cd\u68c0\u6d4b\u8f83\u4e3a\u6709\u6548\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 31,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.463",
+ "object_id": null,
+ "content": "\u6162\u6027\u4e59\u809d\u80fd\u81ea\u6211\u4fee\u590d\u5417\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 32,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.483",
+ "object_id": null,
+ "content": "\u2018\u5c0f\u4e09\u9633\u2019\u4e59\u809d\u5728\u4f53\u5185\u7684\u75c5\u53d8\u8fc7\u7a0b\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 33,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.501",
+ "object_id": null,
+ "content": "\u809d\u708e\u65f6\u4e3a\u4f55\u8f6c\u6c28\u9176\u5347\u9ad8\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 34,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.524",
+ "object_id": null,
+ "content": "\u6162\u6027\u809d\u708e\u60a3\u8005\u8f6c\u6c28\u9176\u6025\u5267\u5347\u9ad8\u4f1a\u6709\u4ec0\u4e48\u95ee\u9898\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 35,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.543",
+ "object_id": null,
+ "content": "\u8f6c\u6c28\u9176\u5347\u9ad8\uff0c\u5fc5\u5b9a\u662f\u809d\u75c5\u52a0\u91cd\u5417\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 36,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.565",
+ "object_id": null,
+ "content": "\u9488\u5bf9\u4e59\u809d\u75c5\u6bd2\u9700\u8981\u4ec0\u4e48\u6837\u7684\u514d\u75ab\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 37,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.585",
+ "object_id": null,
+ "content": "\u514d\u75ab\u7f3a\u9677\u662f\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 38,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.605",
+ "object_id": null,
+ "content": "\u4ec0\u4e48\u6837\u7684\u514d\u75ab\u6cbb\u7597\u4f1a\u6709\u6548\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 39,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.630",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u4f5c\u7528\u4e8e\u4eba\u4f53\u65f6\u6240\u4ea7\u751f\u7684\u514d\u75ab\u6fc0\u5316\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 40,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.655",
+ "object_id": null,
+ "content": "\u6162\u6027\u4e59\u809d\u7684\u75c5\u53d8\u60c5\u51b5?\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 41,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.681",
+ "object_id": null,
+ "content": "\u6297\u75c5\u6bd2\u6cbb\u7597\u662f\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 42,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.704",
+ "object_id": null,
+ "content": "\u6297\u75c5\u6bd2\u6cbb\u7597\u4e0e\u975e\u6297\u75c5\u6bd2\u6cbb\u7597\u7684\u533a\u522b\u70b9\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 43,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.723",
+ "object_id": null,
+ "content": "\u4f55\u65f6\u5f00\u59cb\u542f\u7528\u6297\u75c5\u6bd2\u6cbb\u7597\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 44,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.744",
+ "object_id": null,
+ "content": "\u5bf9\u4e8e\u4e59\u809d\u6cbb\u7597\u6709\u54ea\u4e9b\u836f\u7269\u53ef\u4ee5\u4f7f\u7528\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 45,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.764",
+ "object_id": null,
+ "content": "\u9009\u62e9\u836f\u54c1\u7684\u65f6\u5019\u7ed3\u5408\u6307\u6807\u8fdb\u884c\u5408\u7406\u7684\u63a8\u8350\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 46,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.786",
+ "object_id": null,
+ "content": "\u7ed3\u5408\u6307\u6807\u4ee5\u53ca\u75c5\u53f2\u8fdb\u884c\u5408\u7406\u7684\u89e3\u51b3\u65b9\u6848\u63a8\u8350\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 47,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.807",
+ "object_id": null,
+ "content": "\u9009\u836f\u671f\u95f4\u9700\u8981\u6ce8\u610f\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 48,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.830",
+ "object_id": null,
+ "content": "\u6362\u836f\u671f\u95f4\u9700\u8981\u6ce8\u610f\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 49,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.848",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u548c\u6838\u82f7\u7c7b\u836f\u54c1\u5728\u76f8\u5173\u66ff\u6362\u65f6\u9700\u8981\u6ce8\u610f\u4e9b\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 50,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.870",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u7684\u7597\u7a0b\u957f\u77ed\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 51,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.892",
+ "object_id": null,
+ "content": "\u5bf9\u4e8e\u4f7f\u7528\u5e72\u6270\u7d20\u4e4b\u540e\u4e00\u4e9b\u76f8\u5173\u6307\u6807\u7684\u53d8\u5316\u4ee3\u8868\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 52,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.914",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u7684\u6cbb\u7597\u7ec8\u70b9\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 53,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.939",
+ "object_id": null,
+ "content": "\u54ea\u4e9b\u65b9\u9762\u4ee3\u8868\u5e72\u6270\u7d20\u7684\u6cbb\u7597\u7ec8\u70b9\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 54,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.961",
+ "object_id": null,
+ "content": "\u6838\u82f7\u7c7b\u836f\u7269\u7684\u6cbb\u7597\u7ec8\u70b9\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 55,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:13.986",
+ "object_id": null,
+ "content": "\u54ea\u4e9b\u65b9\u9762\u4ee3\u8868\u6838\u82f7\u7c7b\u7684\u6cbb\u7597\u7ec8\u70b9\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 56,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.007",
+ "object_id": null,
+ "content": "\u505c\u836f\u4e4b\u540e\u9700\u8981\u6ce8\u610f\u4e9b\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 57,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.123",
+ "object_id": null,
+ "content": "\u5b9e\u65f6\u76d1\u63a7\uff0c\u968f\u8bbf\u662f\u4ec0\u4e48\u610f\u601d\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 58,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.146",
+ "object_id": null,
+ "content": "\u5bf9\u4e8e\u968f\u8bbf\u7a76\u7adf\u6709\u591a\u91cd\u8981\uff0c\u9700\u8981\u8fdb\u884c\u600e\u6837\u7684\u5b9a\u671f\u68c0\u67e5\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 59,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.171",
+ "object_id": null,
+ "content": "\u600e\u6837\u7684\u5b9a\u671f\u68c0\u67e5\u7b26\u5408\u8be5\u540d\u60a3\u8005\u7684\u6cbb\u7597\u8fdb\u5ea6\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 60,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.197",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u6bcf\u79cd\u836f\u54c1\u7684\u8be6\u7ec6\u8d44\u6599\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 61,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.221",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u6cbb\u7597\u5728\u77ed\u671f\u5185\u4f1a\u6709\u4ec0\u4e48\u6548\u679c\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 62,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.244",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u7597\u7a0b\u4e00\u822c\u591a\u957f\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 63,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.266",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u6cbb\u7597\u8fdc\u671f\u76ee\u6807\u662f\u4ec0\u4e48\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 64,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.285",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u7684\u836f\u54c1\u6709\u4ec0\u4e48\u4f18\u7f3a\u70b9\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 65,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.310",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u7684\u4e00\u4e2a\u7597\u7a0b\u7ed3\u675f\u540e\u662f\u5426\u9700\u8981\u66f4\u6362\u4f7f\u7528\u53e6\u4e00\u79cd\u5e72\u6270\u7d20\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 66,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.332",
+ "object_id": null,
+ "content": "\u957f\u6548\u5e72\u6270\u7d20\u7684\u4f18\u7f3a\u70b9\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 67,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.359",
+ "object_id": null,
+ "content": "\u957f\u6548\u5e72\u6270\u7d20\u7684\u6cbb\u7597\u6548\u679c\u5982\u4f55\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 68,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.381",
+ "object_id": null,
+ "content": "\u54ea\u4e9b\u60a3\u8005\u53ef\u4ee5\u4f7f\u7528\u957f\u6548\u5e72\u6270\u7d20\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 69,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.404",
+ "object_id": null,
+ "content": "\u957f\u6548\u5e72\u6270\u7d20\u5bf9\u4e0d\u540c\u57fa\u56e0\u578b\u7684\u60a3\u8005\u7684\u7597\u6548\u5e94\u7b54\u6709\u533a\u522b\u5417\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 70,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.424",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u662f\u5426\u4e5f\u4f1a\u4ea7\u751f\u8010\u836f\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 71,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.446",
+ "object_id": null,
+ "content": "\u5e72\u6270\u7d20\u662f\u5426\u4f1a\u6709\u5f3a\u70c8\u7684\u590d\u53d1\u4f5c\u7528\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 72,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.465",
+ "object_id": null,
+ "content": "\u6d3e\u7f57\u6b23\u80fd\u8ffd\u6c42\u8868\u9762\u6297\u539f\u8f6c\u9634\u5417\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 73,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.488",
+ "object_id": null,
+ "content": "\u6d3e\u7f57\u6b23\u9002\u7528\u4e8e\u54ea\u7c7b\u75c5\u4eba\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 74,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.507",
+ "object_id": null,
+ "content": "\u6d3e\u7f57\u6b23\u6709\u54ea\u4e9b\u4e0d\u826f\u53cd\u5e94\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 75,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.527",
+ "object_id": null,
+ "content": "\u54ea\u4e9b\u809d\u75c5\u662f\u6d3e\u7f57\u6b23\u7684\u9002\u5e94\u75c7\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ },
+ {
+ "pk": 76,
+ "model": "info.query",
+ "fields": {
+ "standard_judge": false,
+ "level": 1,
+ "created_at": "2013-04-23T15:05:14.546",
+ "object_id": null,
+ "content": "\u4e4b\u524d\u63a5\u53d7\u6838\u82f7\u7c7b\u836f\u6cbb\u7597\u73b0\u5728\u80fd\u6539\u5e72\u6270\u7d20\u5417\n",
+ "user": 1,
+ "content_type": null,
+ "categoryid": 1
+ }
+ }
+] \ No newline at end of file
diff --git a/97suifangqa/apps/info/forms.py b/97suifangqa/apps/info/forms.py
new file mode 100644
index 0000000..717431d
--- /dev/null
+++ b/97suifangqa/apps/info/forms.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+from haystack.forms import SearchForm
+
+from .models import Query
+from .utils import split_word
+
+class QuerySearchForm(SearchForm):
+ u'''
+ 问题查询表单,主要完成两个工作:
+ 1. 指定查询的model为Query
+ 2. 重载clean_q,对查询语句进行分词
+ '''
+
+ def __init__(self,*args, **kwargs):
+ u'''
+ 在__init__中指定查询的model为Query
+ '''
+ super(QuerySearchForm, self).__init__(*args, **kwargs)
+ self.searchqueryset = self.searchqueryset.models(Query)
+
+ def clean_q(self):
+ q = self.cleaned_data['q']
+ return split_word(q)
diff --git a/97suifangqa/apps/info/models.py b/97suifangqa/apps/info/models.py
new file mode 100644
index 0000000..3bb1203
--- /dev/null
+++ b/97suifangqa/apps/info/models.py
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+from django.db import models
+from django.contrib import admin
+from django.contrib.auth.models import User
+from django.contrib.contenttypes.models import ContentType
+from django.contrib.contenttypes import generic
+
+# Create your models here.
+
+class KeyWord(models.Model):
+
+ content = models.CharField(u"内容", max_length=200)
+ description = models.TextField(u"描述", blank=True)
+ categoryid = models.IntegerField(u"分类编号", null=True, blank=True) #TODO:弄清这里的详细意义
+ standard_judge = models.BooleanField(u"是否为标准关键词", default=False)
+ created_at = models.DateTimeField(auto_now_add=True, verbose_name = u"创建时间")
+ user = models.ForeignKey(User, verbose_name=u"用户", related_name="keywords", null=True, blank=True)
+
+ content_type = models.ForeignKey(ContentType, null=True, blank=True) #将KeyWord作为GFK
+ object_id = models.PositiveIntegerField(null=True, blank=True)
+ content_object = generic.GenericForeignKey("content_type", "object_id")
+
+
+ class Meta:
+ verbose_name_plural = u"关键词"
+
+ def __unicode__(self):
+ return "< KeyWord: %s >" % self.content
+
+
+# Query {{{
+class Query(models.Model):
+
+ content = models.CharField(u"内容", max_length=500)
+ level = models.PositiveIntegerField(u"级数",default=1)
+ categoryid = models.IntegerField(u"分类编号", null=True, blank=True, default=1) #TODO:弄清这里的详细意义
+ created_at = models.DateTimeField(auto_now_add=True, verbose_name = u"创建时间")
+ standard_judge = models.BooleanField(u"是否为标准问题", default=False)
+ user = models.ForeignKey(User, verbose_name=u"用户", related_name="querys")
+
+ content_type = models.ForeignKey(ContentType, null=True, blank=True) #将Query作为GFK
+ object_id = models.PositiveIntegerField(null=True, blank=True)
+ content_object = generic.GenericForeignKey("content_type", "object_id")
+
+
+ class Meta:
+ verbose_name_plural = u"问题"
+
+ def __unicode__(self):
+ return "< Query: %s >" % self.content
+
+ def show(self):
+ """
+ used in 'search/search.html'
+ to show search result
+ """
+ return self.__unicode__()
+# }}}
+
+
+class WordWordRelation(models.Model):
+
+ value = models.FloatField(u"关联度")
+ word1 = models.ForeignKey("KeyWord", verbose_name=u"关键词1", related_name="relations_with_other_words_as_primary", null=True, blank=True)
+ word2 = models.ForeignKey("KeyWord", verbose_name=u"关键词2", related_name="relations_with_other_words_as_deputy", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"关键词与关键词的关系"
+
+ def __unicode__(self):
+ return "< WordWordRelation: (%s, %s) >" % (self.word1.content, self.word2.content)
+
+
+class QueryQueryRelation(models.Model):
+
+ value = models.FloatField(u"关联度")
+ query1 = models.ForeignKey("Query", verbose_name=u"问题1", related_name="relations_with_other_querys_as_primary", null=True, blank=True)
+ query2 = models.ForeignKey("Query", verbose_name=u"问题2", related_name="relations_with_other_querys_as_deputy", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"问题与问题的关系"
+
+ def __unicode__(self):
+ return "< QueryQueryRelation: (%s, %s) >" % (self.query1.content, self.query2.content)
+
+
+class WordQueryRelation(models.Model):
+
+ value = models.FloatField(u"关联度")
+ word = models.ForeignKey("KeyWord", verbose_name=u"关键词", related_name="relations_with_querys", null=True, blank=True)
+ query2 = models.ForeignKey("Query", verbose_name=u"问题", related_name="relations_with_words", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"关键词与问题的关系"
+
+ def __unicode__(self):
+ return "< WordQueryRelation: (%s, %s) >" % (self.word.content, self.query.content)
+
+
+class BlogQueryRelation(models.Model):
+
+ value = models.FloatField(u"关联度")
+ blog = models.ForeignKey("sciblog.SciBlog", verbose_name=u"文章", related_name="relations_with_querys", null=True, blank=True)
+ query = models.ForeignKey("Query", verbose_name=u"问题", related_name="relations_with_blogs", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"文章与问题的关系"
+
+ def __unicode__(self):
+ return "< BlogRelation: (%s, %s) >" % (self.blog.title, self.query.content)
+
+
+admin.site.register([
+ KeyWord,
+ Query,
+ WordWordRelation,
+ WordQueryRelation,
+ BlogQueryRelation,
+ ])
diff --git a/97suifangqa/apps/info/search_indexes.py b/97suifangqa/apps/info/search_indexes.py
new file mode 100644
index 0000000..5491619
--- /dev/null
+++ b/97suifangqa/apps/info/search_indexes.py
@@ -0,0 +1,15 @@
+from haystack import indexes
+import datetime
+from .models import Query
+
+
+class QueryIndex(indexes.SearchIndex, indexes.Indexable):
+ text = indexes.CharField(document=True, use_template=True)
+
+ def get_model(self):
+ return Query
+
+ def index_queryset(self, using=None):
+ """Used when the entire index for model is updated."""
+ return self.get_model().objects.filter(created_at__lte=datetime.datetime.now())
+
diff --git a/97suifangqa/apps/info/tests.py b/97suifangqa/apps/info/tests.py
new file mode 100644
index 0000000..501deb7
--- /dev/null
+++ b/97suifangqa/apps/info/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/info/utils.py b/97suifangqa/apps/info/utils.py
new file mode 100644
index 0000000..18a8648
--- /dev/null
+++ b/97suifangqa/apps/info/utils.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+
+
+def split_word(s):
+ u'''
+ 对查询语句进行分词
+ '''
+ return s
diff --git a/97suifangqa/apps/info/views.py b/97suifangqa/apps/info/views.py
new file mode 100644
index 0000000..7e36296
--- /dev/null
+++ b/97suifangqa/apps/info/views.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+
+from django.shortcuts import render_to_response
+from django.http import HttpResponse,HttpResponseRedirect,HttpResponseNotFound
+from django.template import RequestContext
+
+from haystack.query import SearchQuerySet
+from haystack.inputs import AutoQuery
+
+from .models import Query
+from .forms import QuerySearchForm
+
+
+def query(request):
+ u'''
+ 问题查询
+ '''
+ if request.method == "GET":
+ return render_to_response('search/query/index.html',
+ context_instance=RequestContext(request))
+
+ else:
+ form = QuerySearchForm(request.POST)
+ results = form.search()
+ q = request.POST.get('q', '')
+ return render_to_response('search/query/index.html',
+ locals()
+ , context_instance=RequestContext(request))
+
+
+
+