mixr-api/api_v1/location/model.py

23 lines
814 B
Python
Raw Normal View History

import uuid
from django.db import models
class Location(models.Model):
location_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
longitude = models.DecimalField(max_digits=9, decimal_places=6)
latitude = models.DecimalField(max_digits=9, decimal_places=6)
country_code = models.CharField(max_length=2) # Following ISO-3166-1
country_name = models.CharField(max_length=50)
city = models.CharField(max_length=50)
postal_code = models.CharField(max_length=20)
street = models.CharField(max_length=50)
number = models.CharField(max_length=20)
def __str__(self):
return '{} {}, {} {}, {} {}'.format(self.street, self.number, self.postal_code, self.city, self.country_code,
self.country_name)