From 9636d4a6767f49384d5c386bc3f1142c88b90613 Mon Sep 17 00:00:00 2001 From: Alvin Li Date: Tue, 13 Aug 2013 14:13:24 +0800 Subject: cloned from 'bitbucket', 2013/08/13 --- 97suifangqa/apps/medicine/__init__.py | 0 97suifangqa/apps/medicine/models.py | 50 +++++++++++++++++++++++++++++++++++ 97suifangqa/apps/medicine/tests.py | 16 +++++++++++ 97suifangqa/apps/medicine/views.py | 1 + 4 files changed, 67 insertions(+) create mode 100644 97suifangqa/apps/medicine/__init__.py create mode 100644 97suifangqa/apps/medicine/models.py create mode 100644 97suifangqa/apps/medicine/tests.py create mode 100644 97suifangqa/apps/medicine/views.py (limited to '97suifangqa/apps/medicine') diff --git a/97suifangqa/apps/medicine/__init__.py b/97suifangqa/apps/medicine/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/97suifangqa/apps/medicine/models.py b/97suifangqa/apps/medicine/models.py new file mode 100644 index 0000000..e6cfc88 --- /dev/null +++ b/97suifangqa/apps/medicine/models.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +from django.db import models +from django.contrib import admin + +# Create your models here. +class Medicine(models.Model): + name = models.CharField(u"名称", max_length=100) + category = models.CharField(u" 种类", max_length=100, null=True, blank= True) + pdaLink = models.CharField(u"FDA批准链接", max_length=200, null=True, blank= True) + dosageForm = models.CharField(u"剂型", max_length=100, null=True, blank= True) + specifications = models.ManyToManyField('Specification', related_name='medicines', verbose_name=u"药品规格", null=True, blank=True) + company = models.ForeignKey('Company', related_name='medicines', verbose_name = u"厂家", null=True, blank=True) + instruction = models.FileField(upload_to="upload/instructions", max_length=400, verbose_name = u"说明书", null=True, blank=True) + + class Meta: + verbose_name_plural = u"药物" + + def __unicode__(self): + return u"< Medicine: %s >" % self.id + +class Specification(models.Model): + + value = models.FloatField(u"数值") + unit = models.OneToOneField('indicator.Unit', null=True, blank=True) + + class Meta: + verbose_name_plural = u"药品规格" + + + def __unicode__(self): + return "< Specification: %s >" % self.id + +class Company(models.Model): + + name = models.CharField(u"名称", max_length=100) + nation = models.ForeignKey('location.Nation', related_name='companys', verbose_name = u"国家", null=True, blank=True) + + class Meta: + verbose_name_plural = u"厂家" + + def __unicode__(self): + return "< Company: %s >" % self.id + + + +admin.site.register([ + Medicine, + Specification, + Company, + ]) diff --git a/97suifangqa/apps/medicine/tests.py b/97suifangqa/apps/medicine/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/97suifangqa/apps/medicine/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/medicine/views.py b/97suifangqa/apps/medicine/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/97suifangqa/apps/medicine/views.py @@ -0,0 +1 @@ +# Create your views here. -- cgit v1.2.2