Fix OAuth page

This commit is contained in:
Joren de Graaf
2026-10-19 16:51:53 +02:00
parent a8418cdba7
commit 743785c2e0
54 changed files with 1794 additions and 27 deletions
+31
View File
@@ -0,0 +1,31 @@
import uuid
from django.conf import settings
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.utils import timezone
class DreamEntry(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='dream_entries')
wake_up_date = models.DateField(db_index=True)
dreamed_at = models.DateTimeField(null=True, blank=True)
title = models.CharField(max_length=160)
narrative = models.TextField(max_length=20000)
interpretation = models.TextField(blank=True, max_length=4000)
tags = models.JSONField(default=list, blank=True)
emotions = models.JSONField(default=list, blank=True)
vividness = models.PositiveSmallIntegerField(null=True, blank=True,
validators=[MinValueValidator(0), MaxValueValidator(10)])
is_nightmare = models.BooleanField(default=False)
after_waking_notes = models.TextField(blank=True, max_length=4000)
created_at = models.DateTimeField(default=timezone.now)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
ordering = ('-wake_up_date', '-created_at')
indexes = [models.Index(fields=('user', '-wake_up_date'))]
def __str__(self):
return f'{self.title} ({self.wake_up_date})'