Models
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from .area import Area
|
||||
from .county import County
|
||||
from .post_office import PostOffice
|
||||
@@ -0,0 +1,11 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Area(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
post_office = models.ForeignKey("PostOffice", on_delete=models.CASCADE)
|
||||
county = models.ForeignKey("County", on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
db_table = "areas"
|
||||
ordering = ["name"]
|
||||
@@ -0,0 +1,9 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class County(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
class Meta:
|
||||
db_table = "counties"
|
||||
ordering = ["name"]
|
||||
@@ -0,0 +1,10 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class PostOffice(models.Model):
|
||||
zip = models.PositiveIntegerField()
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
class Meta:
|
||||
db_table = "post_offices"
|
||||
ordering = ["zip"]
|
||||
Reference in New Issue
Block a user