I have no idea what's different

This commit is contained in:
2025-10-10 21:09:50 -05:00
parent d8ff8b3641
commit 77dae021dc
5 changed files with 233 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
from django.db import models
# from .flight import Flight
from django.utils import timezone
class AircraftBase(models.Model):
name = models.CharField(max_length=20)
@@ -22,12 +25,12 @@ class Equipment(models.Model):
"Aerodrome",
on_delete=models.PROTECT,
related_name="based_equipment",
help_text="Home base for this equipment",
help_text="Starting location for this equipment",
null=True,
blank=True,
)
cycles = models.PositiveIntegerField(
default=0, help_text="Total number of flight cycles (takeoff/landing pairs)"
default=0, help_text="Total number of flight cycles"
)
air_time_hours = models.DecimalField(
max_digits=10,
@@ -42,8 +45,6 @@ class Equipment(models.Model):
@property
def current_location(self):
"""Get the current location of this equipment based on flight history."""
from .flight import Flight
from django.utils import timezone
now = timezone.now()
@@ -59,5 +60,4 @@ class Equipment(models.Model):
elif last_flight.arrival_time <= now:
return last_flight.destination
# No flights yet or no flights have departed, equipment is at base
return self.base_location