You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4 KiB
Python

from django.db import models
# Create your models here.
from django.db import models
class Country(models.Model):
class Meta:
verbose_name_plural = "Countries"
NORTH = "N"
SOUTH = "S"
EAST = "E"
WEST = "W"
LATITUDE_CHOICES = (
(NORTH, "N"),
(SOUTH, "S"),
)
LONGITUDE_CHOICES = (
(EAST, "E"),
(WEST, "W"),
)
name = models.CharField(max_length=70)
name_longform = models.CharField(max_length=70, blank=True)
description = models.TextField()
coordinates = models.CharField(max_length=30)
latitude_degrees = models.IntegerField(null=True)
latitude_minutes = models.IntegerField(null=True)
latitude_direction = models.CharField(
max_length=1,
choices = LATITUDE_CHOICES,
default=NORTH,
)
longitude_degrees = models.IntegerField(null=True)
longitude_minutes = models.IntegerField(null=True)
longitude_direction = models.CharField(
max_length=1,
choices = LONGITUDE_CHOICES,
default=EAST,
)
def __str__(self):
return self.name
# class Article(models.Model):
# pub_date = models.DateField()
# headline = models.CharField(max_length=200)
# content = models.TextField()
# reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE)
#
# def __str__(self):
# return self.headline