from django.contrib.auth import get_user_model
from django.db import models
from django_extensions.db.models import TitleSlugDescriptionModel


class Project(TitleSlugDescriptionModel):
    objectives = models.TextField(blank=True)
    appearance = models.CharField(blank=True, null=False, max_length=255)
    student = models.ForeignKey(get_user_model(), on_delete=models.CASCADE, related_name='projects')
    final = models.BooleanField(default=False)

    def __str__(self):
        return self.title


class ProjectEntry(models.Model):
    activity = models.TextField(blank=True)
    reflection = models.TextField(blank=True)
    next_steps = models.TextField(blank=True)
    document_url = models.TextField(blank=True)
    created = models.DateTimeField(auto_now_add=True)
    project = models.ForeignKey(Project, related_name='entries', on_delete=models.CASCADE)

    def __str__(self):
        return self.activity
