67 lines
2.2 KiB
Python
67 lines
2.2 KiB
Python
|
from django.db.models import Model, CharField, ImageField, ForeignKey, ManyToManyField, TimeField, OneToOneField, CASCADE, IntegerField, BooleanField, TextField
|
||
|
from django.contrib.gis.db.models import PointField
|
||
|
from django.conf import settings
|
||
|
|
||
|
from vies.models import VATINField
|
||
|
from django_countries.fields import CountryField
|
||
|
from phonenumber_field.modelfields import PhoneNumberField
|
||
|
from multiselectfield import MultiSelectField
|
||
|
from polymorphic.models import PolymorphicModel
|
||
|
|
||
|
from profiles.models import PartnerProfile
|
||
|
from offers.utils import WEEKDAY_CHOICES, WIFI_AVAILABILITY_CHOICES, PETS_CHOICES, ACTIVITIES_CHOICES, DESCRIPTION_LANGUAGE_CHOICES
|
||
|
|
||
|
# Create your models here.
|
||
|
|
||
|
class Hours(Model):
|
||
|
day = MultiSelectField(choices=WEEKDAY_CHOICES)
|
||
|
start = TimeField()
|
||
|
end = TimeField()
|
||
|
|
||
|
class Offer(PolymorphicModel):
|
||
|
name = CharField(max_length=128)
|
||
|
address = CharField(max_length=128)
|
||
|
address2 = CharField(max_length=128, blank=True, null=True)
|
||
|
zipcode = CharField(max_length=15)
|
||
|
city = CharField(max_length=128)
|
||
|
country = CountryField()
|
||
|
phone = PhoneNumberField()
|
||
|
logo = ImageField(null=True)
|
||
|
location = PointField()
|
||
|
partners = ManyToManyField(PartnerProfile)
|
||
|
|
||
|
class Hotel(Offer):
|
||
|
pass
|
||
|
|
||
|
class Descriptions(Model):
|
||
|
offer = OneToOneField(Offer, on_delete=CASCADE)
|
||
|
default = CharField(max_length=12, choices=DESCRIPTION_LANGUAGE_CHOICES)
|
||
|
de = TextField(max_length=2048, null=True, blank=True)
|
||
|
en = TextField(max_length=2048, null=True, blank=True)
|
||
|
|
||
|
class HotelOptions(Model):
|
||
|
hotel = OneToOneField(Hotel, on_delete=CASCADE)
|
||
|
|
||
|
# Reception
|
||
|
|
||
|
reception = ManyToManyField(Hours)
|
||
|
checkout = TimeField(blank=True, null=True)
|
||
|
checkin = TimeField(null=True, blank=True)
|
||
|
|
||
|
# Furry guests
|
||
|
|
||
|
pets = IntegerField(choices=PETS_CHOICES, blank=True, null=True)
|
||
|
|
||
|
# WiFi
|
||
|
wifi = IntegerField(choices=WIFI_AVAILABILITY_CHOICES, blank=True, null=True)
|
||
|
wifi_cost = BooleanField(null=True)
|
||
|
wifi_notes = TextField()
|
||
|
|
||
|
# Activities
|
||
|
|
||
|
activities = MultiSelectField(choices=ACTIVITIES_CHOICES)
|
||
|
|
||
|
class OfferImage(Model):
|
||
|
offer = ForeignKey(Offer, on_delete=CASCADE)
|
||
|
image = ImageField()
|
||
|
is_primary = BooleanField(default=False)
|