from django.db.models import Model, ForeignKey, UUIDField, DateTimeField, DecimalField, PositiveIntegerField, DateField, CharField, ForeignKey, CASCADE, SET_NULL from django.contrib.gis.db.models import PointField from django.urls import reverse_lazy from django.conf import settings from uuid import uuid4 from profiles.models import ClientProfile, ContactProfile class Inquiry(Model): uuid = UUIDField(default=uuid4, primary_key=True) user = ForeignKey(ClientProfile, null=True, on_delete=CASCADE) amount = DecimalField(max_digits=25, decimal_places=2) currency = CharField(max_length=3, choices=settings.CURRENCIES) first_date = DateField() last_date = DateField() destination_name = CharField(max_length=128) destination_geo = PointField() adults = PositiveIntegerField() children = PositiveIntegerField(default=0) posted = DateTimeField(auto_now_add=True) contact = ForeignKey(ContactProfile, null=True, on_delete=SET_NULL) def get_absolute_url(self): return reverse_lazy("auction:payment", kwargs={'pk': self.uuid})