from django.db import models
from django.contrib.auth.models import User



# Create your models here.
class Post(models.Model):
    title = models.CharField(max_length=255,unique=True)
    url = models.URLField(unique=True)
    poster = models.ForeignKey(User,on_delete=models.CASCADE)
    created = models.DateTimeField(auto_now_add=True)

    class Meta:
        ordering = ['-created']

class Vote(models.Model):
    voter =  models.ForeignKey(User,on_delete=models.CASCADE)   
    post =  models.ForeignKey(Post,on_delete=models.CASCADE)   


     
# C reate/add = POST    
# R etrieve/Fetch = GET
# U pdate/Edit = PUT
# D elete/Remove = DELETE