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


class UserProfile(AbstractUser):
    last_request = models.DateTimeField(auto_now_add=True)


class Post(models.Model):
    text = models.TextField()
    pub_date = models.DateTimeField("date published", auto_now_add=True)
    author = models.ForeignKey(
        UserProfile, on_delete=models.CASCADE, related_name="posts"
    )

    def __str__(self):
        return self.text

    class Meta:
        ordering = ("-pub_date",)


class Like(models.Model):
    post = models.ForeignKey(Post, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
    pub_date = models.DateTimeField("date published", auto_now_add=True)

    class Meta:
        unique_together = ("user", "post")

9b7f63a397aa71c8d9f0a5f3a1b86ca6ab60446f
<mask token>


class Like(models.Model):
    post = models.ForeignKey(Post, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
    pub_date = models.DateTimeField('date published', auto_now_add=True)


    class Meta:
        unique_together = 'user', 'post'

<mask token>


class UserProfile(AbstractUser):
    <mask token>


class Post(models.Model):
    text = models.TextField()
    pub_date = models.DateTimeField('date published', auto_now_add=True)
    author = models.ForeignKey(UserProfile, on_delete=models.CASCADE,
        related_name='posts')

    def __str__(self):
        return self.text


    class Meta:
        ordering = '-pub_date',


class Like(models.Model):
    post = models.ForeignKey(Post, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
    pub_date = models.DateTimeField('date published', auto_now_add=True)


    class Meta:
        unique_together = 'user', 'post'

<mask token>


class UserProfile(AbstractUser):
    last_request = models.DateTimeField(auto_now_add=True)


class Post(models.Model):
    text = models.TextField()
    pub_date = models.DateTimeField('date published', auto_now_add=True)
    author = models.ForeignKey(UserProfile, on_delete=models.CASCADE,
        related_name='posts')

    def __str__(self):
        return self.text


    class Meta:
        ordering = '-pub_date',


class Like(models.Model):
    post = models.ForeignKey(Post, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
    pub_date = models.DateTimeField('date published', auto_now_add=True)


    class Meta:
        unique_together = 'user', 'post'

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


class UserProfile(AbstractUser):
    last_request = models.DateTimeField(auto_now_add=True)


class Post(models.Model):
    text = models.TextField()
    pub_date = models.DateTimeField('date published', auto_now_add=True)
    author = models.ForeignKey(UserProfile, on_delete=models.CASCADE,
        related_name='posts')

    def __str__(self):
        return self.text


    class Meta:
        ordering = '-pub_date',


class Like(models.Model):
    post = models.ForeignKey(Post, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
    pub_date = models.DateTimeField('date published', auto_now_add=True)


    class Meta:
        unique_together = 'user', 'post'

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


class UserProfile(AbstractUser):
    last_request = models.DateTimeField(auto_now_add=True)


class Post(models.Model):
    text = models.TextField()
    pub_date = models.DateTimeField("date published", auto_now_add=True)
    author = models.ForeignKey(
        UserProfile, on_delete=models.CASCADE, related_name="posts"
    )

    def __str__(self):
        return self.text

    class Meta:
        ordering = ("-pub_date",)


class Like(models.Model):
    post = models.ForeignKey(Post, on_delete=models.CASCADE)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
    pub_date = models.DateTimeField("date published", auto_now_add=True)

    class Meta:
        unique_together = ("user", "post")
