mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-18 20:39:36 +02:00
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
|
from django.db import models
|
||
|
|
||
|
from django.contrib.auth import get_user_model
|
||
|
from django.contrib.postgres.fields import ArrayField
|
||
|
|
||
|
|
||
|
# Assuming you have a default user ID you want to use
|
||
|
default_user_id = 1 # Replace with an actual user ID
|
||
|
|
||
|
User = get_user_model()
|
||
|
|
||
|
|
||
|
class Adventure(models.Model):
|
||
|
id = models.AutoField(primary_key=True)
|
||
|
user_id = models.ForeignKey(
|
||
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||
|
type = models.CharField(max_length=100)
|
||
|
name = models.CharField(max_length=200)
|
||
|
location = models.CharField(max_length=200, blank=True, null=True)
|
||
|
activity_types = ArrayField(models.CharField(
|
||
|
max_length=100), blank=True, null=True)
|
||
|
description = models.TextField(blank=True, null=True)
|
||
|
rating = models.FloatField(blank=True, null=True)
|
||
|
link = models.URLField(blank=True, null=True)
|
||
|
image = models.ImageField(null=True, blank=True, upload_to='images/')
|
||
|
date = models.DateField(blank=True, null=True)
|
||
|
trip_id = models.IntegerField(blank=True, null=True)
|
||
|
is_public = models.BooleanField(default=False)
|
||
|
longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||
|
latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||
|
|
||
|
def __str__(self):
|
||
|
return self.name
|