Commit e417ad41 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

changed state field from charfield to USStateField

parent e426786f
from django.db import models from django.db import models
from autoslug import AutoSlugField from autoslug import AutoSlugField
from model_utils.models import TimeStampedModel from model_utils.models import TimeStampedModel
from django.contrib.auth.models import User from django.contrib.auth.models import User
from localflavor.us.models import USStateField
class Building(TimeStampedModel): class Building(TimeStampedModel):
name = models.CharField(max_length=100) name = models.CharField(max_length=100)
...@@ -44,11 +45,10 @@ class Room(TimeStampedModel): ...@@ -44,11 +45,10 @@ class Room(TimeStampedModel):
def __str__(self): # __unicode__ on Python 2 def __str__(self): # __unicode__ on Python 2
return self.building.__str__()+" "+self.number.__str__() return self.building.__str__()+" "+self.number.__str__()
class Address(TimeStampedModel): class Address(TimeStampedModel):
street = models.CharField(max_length=100) street = models.CharField(max_length=100)
zip_code = models.IntegerField(max_length=5) zip_code = models.IntegerField(max_length=5)
state = models.CharField(max_length=2) state = USStateField()
class Meta: class Meta:
verbose_name_plural = 'addresses' verbose_name_plural = 'addresses'
...@@ -56,7 +56,6 @@ class Address(TimeStampedModel): ...@@ -56,7 +56,6 @@ class Address(TimeStampedModel):
def __str__(self): # __unicode__ on Python 2 def __str__(self): # __unicode__ on Python 2
return self.street return self.street
class Class(TimeStampedModel): class Class(TimeStampedModel):
year_int = models.IntegerField() year_int = models.IntegerField()
FRESHMAN = 'FR' FRESHMAN = 'FR'
...@@ -75,6 +74,5 @@ class Class(TimeStampedModel): ...@@ -75,6 +74,5 @@ class Class(TimeStampedModel):
class Meta: class Meta:
verbose_name_plural = 'classes' verbose_name_plural = 'classes'
def __str__(self): # __unicode__ on Python 2 def __str__(self): # __unicode__ on Python 2
return str(self.year_int) return str(self.year_int)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment