from datetime import datetime
from django.contrib.auth import get_user_model
from django.db import models
from django.urls import reverse


class Article(models.Model):
    title = models.CharField(max_length=70)
    body = models.TextField()
    date = models.DateTimeField(default=datetime.now)
    author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)


    class Meta:
        verbose_name = 'Статья'
        verbose_name_plural = 'Статьи'

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('detail', args=[str(self.id)])


class Comment(models.Model):
    article = models.ForeignKey(Article, on_delete=models.CASCADE,
        related_name='comments')
    comment = models.CharField(max_length=120)
    author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)


    class Meta:
        verbose_name = 'Коментарий'
        verbose_name_plural = 'Коментарии'

    def __str__(self):
        return self.comment

    def get_absolute_url(self):
        return reverse('detail', args=[str(self.id)])

7abecb6063575e23cc7b016eb2ca5a4e82b9ccd7
<mask token>


class Article(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


    class Meta:
        verbose_name = 'Статья'
        verbose_name_plural = 'Статьи'
    <mask token>
    <mask token>


class Comment(models.Model):
    article = models.ForeignKey(Article, on_delete=models.CASCADE,
        related_name='comments')
    comment = models.CharField(max_length=120)
    author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)


    class Meta:
        verbose_name = 'Коментарий'
        verbose_name_plural = 'Коментарии'

    def __str__(self):
        return self.comment

    def get_absolute_url(self):
        return reverse('detail', args=[str(self.id)])

<mask token>


class Article(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


    class Meta:
        verbose_name = 'Статья'
        verbose_name_plural = 'Статьи'

    def __str__(self):
        return self.title
    <mask token>


class Comment(models.Model):
    article = models.ForeignKey(Article, on_delete=models.CASCADE,
        related_name='comments')
    comment = models.CharField(max_length=120)
    author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)


    class Meta:
        verbose_name = 'Коментарий'
        verbose_name_plural = 'Коментарии'

    def __str__(self):
        return self.comment

    def get_absolute_url(self):
        return reverse('detail', args=[str(self.id)])

<mask token>


class Article(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


    class Meta:
        verbose_name = 'Статья'
        verbose_name_plural = 'Статьи'

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('detail', args=[str(self.id)])


class Comment(models.Model):
    article = models.ForeignKey(Article, on_delete=models.CASCADE,
        related_name='comments')
    comment = models.CharField(max_length=120)
    author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)


    class Meta:
        verbose_name = 'Коментарий'
        verbose_name_plural = 'Коментарии'

    def __str__(self):
        return self.comment

    def get_absolute_url(self):
        return reverse('detail', args=[str(self.id)])

from datetime import datetime
from django.contrib.auth import get_user_model
from django.db import models
from django.urls import reverse


class Article(models.Model):
    title = models.CharField(max_length=70)
    body = models.TextField()
    date = models.DateTimeField(default=datetime.now)
    author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)


    class Meta:
        verbose_name = 'Статья'
        verbose_name_plural = 'Статьи'

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('detail', args=[str(self.id)])


class Comment(models.Model):
    article = models.ForeignKey(Article, on_delete=models.CASCADE,
        related_name='comments')
    comment = models.CharField(max_length=120)
    author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)


    class Meta:
        verbose_name = 'Коментарий'
        verbose_name_plural = 'Коментарии'

    def __str__(self):
        return self.comment

    def get_absolute_url(self):
        return reverse('detail', args=[str(self.id)])
