26 lines
773 B
Python
26 lines
773 B
Python
from django.db import models
|
|
|
|
class Unit(models.Model):
|
|
UNIT_TYPE_CHOICES = [
|
|
('Ambulance', 'Ambulance'),
|
|
('Police Car', 'Police Car'),
|
|
]
|
|
STATUS_CHOICES = [
|
|
('Available', 'Available'),
|
|
('Dispatched', 'Dispatched'),
|
|
('Refueling', 'Refueling'),
|
|
('Out of Service', 'Out of Service'),
|
|
]
|
|
|
|
unit_id = models.CharField(max_length=100, unique=True)
|
|
unit_type = models.CharField(max_length=50, choices=UNIT_TYPE_CHOICES)
|
|
location_lat = models.FloatField(default=0.0)
|
|
location_lon = models.FloatField(default=0.0)
|
|
status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='Available')
|
|
|
|
def __str__(self):
|
|
return self.unit_id
|
|
|
|
class Meta:
|
|
ordering = ['unit_id']
|