aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/location
diff options
context:
space:
mode:
Diffstat (limited to '97suifangqa/apps/location')
-rw-r--r--97suifangqa/apps/location/__init__.py0
-rw-r--r--97suifangqa/apps/location/fixtures/initial_data.json81
-rw-r--r--97suifangqa/apps/location/models.py63
3 files changed, 144 insertions, 0 deletions
diff --git a/97suifangqa/apps/location/__init__.py b/97suifangqa/apps/location/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/97suifangqa/apps/location/__init__.py
diff --git a/97suifangqa/apps/location/fixtures/initial_data.json b/97suifangqa/apps/location/fixtures/initial_data.json
new file mode 100644
index 0000000..a06ec34
--- /dev/null
+++ b/97suifangqa/apps/location/fixtures/initial_data.json
@@ -0,0 +1,81 @@
+[
+ {
+ "pk": 1,
+ "model": "location.hospital",
+ "fields": {
+ "city": null,
+ "name": "\u53f0\u5927\u533b\u9662\u5185\u79d1\u90e8",
+ "unit": null
+ }
+ },
+ {
+ "pk": 2,
+ "model": "location.hospital",
+ "fields": {
+ "city": null,
+ "name": "\u9999\u6e2f\u739b\u4e3d\u533b\u9662",
+ "unit": null
+ }
+ },
+ {
+ "pk": 3,
+ "model": "location.hospital",
+ "fields": {
+ "city": null,
+ "name": "\u5317\u4eac\u4f51\u5b89\u533b\u9662\u6d88\u5316\u5185\u79d1",
+ "unit": null
+ }
+ },
+ {
+ "pk": 4,
+ "model": "location.hospital",
+ "fields": {
+ "city": 1,
+ "name": "\u4e0a\u6d77\u745e\u91d1\u533b\u9662\u611f\u67d3\u79d1",
+ "unit": null
+ }
+ },
+ {
+ "pk": 5,
+ "model": "location.hospital",
+ "fields": {
+ "city": null,
+ "name": "\u5df4\u9ece\u5927\u5b66",
+ "unit": null
+ }
+ },
+ {
+ "pk": 6,
+ "model": "location.hospital",
+ "fields": {
+ "city": null,
+ "name": "Songklanagarind\u533b\u9662",
+ "unit": null
+ }
+ },
+ {
+ "pk": 7,
+ "model": "location.hospital",
+ "fields": {
+ "city": null,
+ "name": "Erasmus MC \u5927\u5b66\u533b\u5b66\u4e2d\u5fc3",
+ "unit": null
+ }
+ },
+ {
+ "pk": 1,
+ "model": "location.city",
+ "fields": {
+ "name": "\u4e0a\u6d77",
+ "nation": 1
+ }
+ },
+ {
+ "pk": 1,
+ "model": "location.nation",
+ "fields": {
+ "name": "\u4e2d\u56fd",
+ "img": ""
+ }
+ }
+] \ No newline at end of file
diff --git a/97suifangqa/apps/location/models.py b/97suifangqa/apps/location/models.py
new file mode 100644
index 0000000..d8c6552
--- /dev/null
+++ b/97suifangqa/apps/location/models.py
@@ -0,0 +1,63 @@
+#-*- coding: utf-8 -*-
+
+from django.db import models
+from django.contrib import admin
+
+
+class Location(models.Model):
+
+ latitude = models.FloatField(u"经度")
+ longitude = models.FloatField(u"纬度")
+ city = models.CharField(u"城市", max_length=20, null=True, blank=True)
+ nation = models.CharField(u"国家", max_length=20, null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"地理位置"
+
+ def __unicode__(self):
+ return u"< Location : %s >" % self.id
+
+
+class Hospital(models.Model):
+
+ name = models.CharField(u"名称", max_length=100)
+ city = models.ForeignKey("City", related_name="hospitals", verbose_name = u"城市", null=True, blank=True)
+ unit = models.ForeignKey("indicator.Unit", related_name="hospitals", verbose_name = u"单位", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"医院"
+
+ def __unicode__(self):
+ return "< Hospital: %s >" % self.name
+
+
+class City(models.Model):
+
+ name = models.CharField(u"名称", max_length=100)
+ nation = models.ForeignKey("Nation", related_name="cities", verbose_name = "国家", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"城市"
+
+ def __unicode__(self):
+ return "< City: %s >" % self.name
+
+
+class Nation(models.Model):
+
+ name = models.CharField(u"名称", max_length=100)
+ img = models.ImageField(u"国旗图标", upload_to="uploads/flags/", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"国家"
+
+ def __unicode__(self):
+ return "< Nation: %s >" % self.name
+
+
+admin.site.register([
+ Location,
+ Hospital,
+ City,
+ Nation,
+ ])