from django.conf import settings
from django.db import models
from django.template.defaultfilters import truncatechars
from django.utils import timezone
class Post(models.Model):
    author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    title = models.CharField(max_length=200)
    text = models.TextField()
    
    created_date = models.DateTimeField(default=timezone.now)
    published_date = models.DateTimeField(blank=True, null=True)
    def publish(self):
        self.published_date = timezone.now()
        self.save()
    def __str__(self):
        return self.title

        
class Skill(models.Model):
    author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    skill = models.CharField(max_length=200)
    detail = models.TextField()
    created_date = models.DateTimeField(default=timezone.now)
    published_date = models.DateTimeField(blank=True, null=True)
    def publish(self):
        self.published_date = timezone.now()
        self.save()
    def __str__(self):
        return self.skill
class Responsibility(models.Model):
    responsibility = models.CharField(max_length=200)
    detail = models.TextField()
    def __str__(self):
        return self.responsibility      
        
class Experience(models.Model):
    experience = models.CharField(max_length=200)
    detail = models.TextField()
    def __str__(self):
        return self.experience   
        
class Hobby(models.Model):
    hobby = models.CharField(max_length=200)
    detail = models.TextField()
    def __str__(self):
        return self.hobby     
        
