Skip to content

Commit

Permalink
syncdb works now that models.py is cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
natea committed May 18, 2013
1 parent 4178891 commit d8dccc7
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 35 deletions.
78 changes: 44 additions & 34 deletions sim/seedbank/models.py
@@ -1,29 +1,20 @@
from django.db import models

# Create your models here.
class Seed(models.Model):

This comment has been minimized.

Copy link
@briandant

briandant May 18, 2013

Seed had to be moved down b/c some of the related models below were referencing it. (See below)

accession_num = models.CharField(max_length=8, blank=False)
lot_num = models.CharField(max_length=5, blank=False)
aquisition_date = models.DateField(blank=False)
cost = models.DecimalField(max_length=4, blank=False)

aquisition_location = models.ForeignKey(Location)
family = models.ForeignKey(Family)
variety = models.ForeignKey(Variety)
scientific_name = models.ForeignKey(ScientificName)
germination = models.ForeignKey(Germination)
class Location(models.Model):
location_name = models.CharField(max_length=45, blank=False)
location_code = models.CharField(max_length=45, blank=False)
location_type = models.CharField(max_length=45)


class Family(models.Model):
family = models.CharField(max_length=45, blank=False)

# I think this one is supposed to be here... ?
supplier = models.ForeignKey(Supplier)

class ScientificName(models.Model):
scientific_name = models.CharField(max_length=45, blank=False)

class CommonName(models.Model):
common_name = models.CharField(max_length=45)
langs = (("English", "English"), ("Thai", "Thai"))
language = models.CharField(max_length=45, choices=langs, default="English")
scientific_name = models.ForeignKey(ScientificName)

class Variety(models.Model):
variety = models.CharField(max_length=45, blank=False)
Expand All @@ -34,37 +25,56 @@ class Variety(models.Model):

scientific_name = models.ForeignKey(ScientificName)

class Family(models.Model):
family = models.CharField(max_length=45, blank=False)

class Location(models.Model):
location_name = models.CharField(max_length=45, blank=False)
location_code = models.CharField(max_length=45, blank=False)
location_type = models.CharField(max_length=45)

class Germination(models.Model):
germ_rate = models.DecimalField(max_length=6, blank=False)
germ_rate = models.DecimalField(decimal_places=2, max_digits=2, blank=False)

This comment has been minimized.

Copy link
@briandant

briandant May 18, 2013

Added decimal_places and max_digits as they are required by DecimalField.

germ_date = models.DateField(blank=False)
germ_method = models.TextField()


class CommonName(models.Model):
common_name = models.CharField(max_length=45)
langs = (("English", "English"), ("Thai", "Thai"))
language = models.CharField(max_length=45, choices=langs, default="English")
scientific_name = models.ForeignKey(ScientificName)


class SupplierType(models.Model):
supplier_type = models.CharField(max_length=45)


class Supplier(models.Model):
supplier_name = model.CharField(max_length=45, blank=False)
supplier_name = models.CharField(max_length=45, blank=False)
contact_first_name = models.CharField(max_length=45)
contact_last_name = models.CharField(max_length=45)
contact_phone = models.CharField(max_length=15)
contact_email = models.EmailField()
address_one = models.CharField(max_length=45, blank=False)
address_two = models.CharField(max_length=45)
city = models.CharField(max_length=45, blank=False)
state = models.USStateField()
address_one = models.CharField(max_length=255, blank=False)

This comment has been minimized.

Copy link
@briandant

briandant May 18, 2013

We changed a few of the lengths of fields (because last week I didn't have them set properly in the visual schema).

address_two = models.CharField(max_length=255)
city = models.CharField(max_length=255, blank=False)
state = models.CharField(max_length=45)
zip_code = models.IntegerField(max_length=10)
country = models.CharField(max_length=45, blank=False)
phone = models.CharField(max_length=15)
email = models.EmailField()
website = models.URLField()

supplier_type = models.ForeignKey(SupplierTypes)
supplier_type = models.ForeignKey(SupplierType)
primary_seed_bank = models.ForeignKey(Location)

class SupplierType(models.Model):
supplier_type = models.CharField(max_length=45)


class Seed(models.Model):
accession_num = models.CharField(max_length=8, blank=False)
lot_num = models.CharField(max_length=5, blank=False)
aquisition_date = models.DateField(blank=False)
cost = models.DecimalField(decimal_places=2, max_digits=6, blank=False)

aquisition_location = models.ForeignKey(Location)

This comment has been minimized.

Copy link
@briandant

briandant May 18, 2013

In order to call Location, it needs to be defined above (this is why we moved Seed lower.

family = models.ForeignKey(Family)
variety = models.ForeignKey(Variety)
scientific_name = models.ForeignKey(ScientificName)
germination = models.ForeignKey(Germination)

# I think this one is supposed to be here... ?
supplier = models.ForeignKey(Supplier)

3 changes: 2 additions & 1 deletion sim/sim/settings/base.py
Expand Up @@ -109,7 +109,7 @@
########## SECRET CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Note: This key only used for development and testing.
SECRET_KEY = r"+u0o-k-fqyi$c(3@q(w$2d9gxkshggu$vhz#h7g%p%s*jcmvdj"
SECRET_KEY = r"blah"
########## END SECRET CONFIGURATION


Expand Down Expand Up @@ -191,6 +191,7 @@

# Apps specific for this project go here.
LOCAL_APPS = (
'seedbank',
)

# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
Expand Down

0 comments on commit d8dccc7

Please sign in to comment.