Improve offer and inquiry classes
This commit is contained in:
parent
d465d05d90
commit
5b4d51341d
1 changed files with 11 additions and 1 deletions
|
@ -13,7 +13,7 @@ class Inquiry(models.Model):
|
||||||
budget = models.DecimalField(max_digits=10, decimal_places=2)
|
budget = models.DecimalField(max_digits=10, decimal_places=2)
|
||||||
adults = models.IntegerField()
|
adults = models.IntegerField()
|
||||||
children = models.IntegerField()
|
children = models.IntegerField()
|
||||||
comment = models.TextField()
|
comment = models.TextField(null=True, blank=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_paid(self):
|
def is_paid(self):
|
||||||
|
@ -25,8 +25,18 @@ class Inquiry(models.Model):
|
||||||
def get_hotels(self):
|
def get_hotels(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@property
|
||||||
|
def accepted(self):
|
||||||
|
qset = Offer.objects.filter(inquiry=self, accepted=True)
|
||||||
|
|
||||||
|
if qset:
|
||||||
|
return qset[0]
|
||||||
|
|
||||||
class Offer(models.Model):
|
class Offer(models.Model):
|
||||||
inquiry = models.ForeignKey(Inquiry, models.PROTECT)
|
inquiry = models.ForeignKey(Inquiry, models.PROTECT)
|
||||||
establishment = models.ForeignKey(Establishment, models.PROTECT)
|
establishment = models.ForeignKey(Establishment, models.PROTECT)
|
||||||
arrival = models.DateTimeField()
|
arrival = models.DateTimeField()
|
||||||
departure = models.DateTimeField()
|
departure = models.DateTimeField()
|
||||||
|
comment = models.TextField(null=True, blank=True)
|
||||||
|
accepted = models.BooleanField(default=False)
|
||||||
|
hidden = models.BooleanField(default=False)
|
Loading…
Reference in a new issue