42 lines
No EOL
1.3 KiB
Python
42 lines
No EOL
1.3 KiB
Python
from django.contrib.gis.db import models
|
|
|
|
from clients.models import ClientProfile
|
|
from partners.models import Establishment
|
|
|
|
class Inquiry(models.Model):
|
|
client = models.ForeignKey(ClientProfile, models.PROTECT)
|
|
destination_name = models.CharField(max_length=128)
|
|
destination_coords = models.PointField()
|
|
destination_radius = models.IntegerField()
|
|
arrival_from = models.DateTimeField()
|
|
departure_until = models.DateTimeField()
|
|
budget = models.DecimalField(max_digits=10, decimal_places=2)
|
|
adults = models.IntegerField()
|
|
children = models.IntegerField()
|
|
comment = models.TextField(null=True, blank=True)
|
|
|
|
@property
|
|
def is_paid(self):
|
|
if not self.invoice:
|
|
return False
|
|
|
|
return self.invoice.is_paid
|
|
|
|
def get_hotels(self):
|
|
pass
|
|
|
|
@property
|
|
def accepted(self):
|
|
qset = Offer.objects.filter(inquiry=self, accepted=True)
|
|
|
|
if qset:
|
|
return qset[0]
|
|
|
|
class Offer(models.Model):
|
|
inquiry = models.ForeignKey(Inquiry, models.PROTECT)
|
|
establishment = models.ForeignKey(Establishment, models.PROTECT)
|
|
arrival = models.DateTimeField()
|
|
departure = models.DateTimeField()
|
|
comment = models.TextField(null=True, blank=True)
|
|
accepted = models.BooleanField(default=False)
|
|
hidden = models.BooleanField(default=False) |