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

User = get_user_model()


class BaseModel(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)

    class Meta:
        abstract = True


class Post(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="posts")
    title = models.CharField(max_length=200)
    text = models.TextField(null=True, blank=True)

    def __str__(self):
        return f"{self.title}: {self.created_at}"


class Like(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="likes")
    post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name="likes")

    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"{self.author.email} on post: {self.post.title} at {self.created_at}"

    class Meta:
        unique_together = ["author", "post"]


class Bot(BaseModel):
    user = models.OneToOneField(
        User, null=True, blank=True, on_delete=models.CASCADE, related_name="bot"
    )

    def __str__(self):
        return self.user.email

1f120f7e86b08c7cb098711d7ecc4b3ae43b9f7c
<mask token>


class Post(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name
        ='posts')
    title = models.CharField(max_length=200)
    text = models.TextField(null=True, blank=True)

    def __str__(self):
        return f'{self.title}: {self.created_at}'


class Like(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name
        ='likes')
    post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name=
        'likes')
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return (
            f'{self.author.email} on post: {self.post.title} at {self.created_at}'
            )


    class Meta:
        unique_together = ['author', 'post']


class Bot(BaseModel):
    user = models.OneToOneField(User, null=True, blank=True, on_delete=
        models.CASCADE, related_name='bot')

    def __str__(self):
        return self.user.email

<mask token>


class BaseModel(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)


    class Meta:
        abstract = True


class Post(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name
        ='posts')
    title = models.CharField(max_length=200)
    text = models.TextField(null=True, blank=True)

    def __str__(self):
        return f'{self.title}: {self.created_at}'


class Like(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name
        ='likes')
    post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name=
        'likes')
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return (
            f'{self.author.email} on post: {self.post.title} at {self.created_at}'
            )


    class Meta:
        unique_together = ['author', 'post']


class Bot(BaseModel):
    user = models.OneToOneField(User, null=True, blank=True, on_delete=
        models.CASCADE, related_name='bot')

    def __str__(self):
        return self.user.email

<mask token>
User = get_user_model()


class BaseModel(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)


    class Meta:
        abstract = True


class Post(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name
        ='posts')
    title = models.CharField(max_length=200)
    text = models.TextField(null=True, blank=True)

    def __str__(self):
        return f'{self.title}: {self.created_at}'


class Like(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name
        ='likes')
    post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name=
        'likes')
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return (
            f'{self.author.email} on post: {self.post.title} at {self.created_at}'
            )


    class Meta:
        unique_together = ['author', 'post']


class Bot(BaseModel):
    user = models.OneToOneField(User, null=True, blank=True, on_delete=
        models.CASCADE, related_name='bot')

    def __str__(self):
        return self.user.email

from django.contrib.auth import get_user_model
from django.db import models
User = get_user_model()


class BaseModel(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)


    class Meta:
        abstract = True


class Post(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name
        ='posts')
    title = models.CharField(max_length=200)
    text = models.TextField(null=True, blank=True)

    def __str__(self):
        return f'{self.title}: {self.created_at}'


class Like(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name
        ='likes')
    post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name=
        'likes')
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return (
            f'{self.author.email} on post: {self.post.title} at {self.created_at}'
            )


    class Meta:
        unique_together = ['author', 'post']


class Bot(BaseModel):
    user = models.OneToOneField(User, null=True, blank=True, on_delete=
        models.CASCADE, related_name='bot')

    def __str__(self):
        return self.user.email

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

User = get_user_model()


class BaseModel(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)

    class Meta:
        abstract = True


class Post(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="posts")
    title = models.CharField(max_length=200)
    text = models.TextField(null=True, blank=True)

    def __str__(self):
        return f"{self.title}: {self.created_at}"


class Like(BaseModel):
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="likes")
    post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name="likes")

    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return f"{self.author.email} on post: {self.post.title} at {self.created_at}"

    class Meta:
        unique_together = ["author", "post"]


class Bot(BaseModel):
    user = models.OneToOneField(
        User, null=True, blank=True, on_delete=models.CASCADE, related_name="bot"
    )

    def __str__(self):
        return self.user.email
