<commit_before>from django.db import models


class Publication(models.Model):
    author = models.ForeignKey('profiles.Profile', null=True)
    title = models.CharField(max_length=125, blank=False)
    content = models.TextField(max_length=500, blank=False)

    class Meta:
        unique_together = (('author', 'title'),)


class PublicationComment(models.Model):
    author = models.ForeignKey('profiles.Profile', null=True)
    content = models.TextField(max_length=500, blank=False)
    date_posted = models.DateTimeField(auto_now_add=True)
    publication = models.ForeignKey(Publication, related_name='comments')<commit_msg>Added Publiction visibility, PublicationLike and PublicationComment<commit_after>from django.db import models


class Publication(models.Model):
    PUBLIC, PRIVATE = range(2)
    VISIBILITY_CHOICES = (
        PUBLIC, 'Public',
        PRIVATE, 'Private')

    author = models.ForeignKey('profiles.Profile', null=True)
    title = models.CharField(max_length=125, blank=False)
    content = models.TextField(max_length=500, blank=False)
    visibility = models.SmallIntegerField(choices=VISIBILITY_CHOICES, default=PUBLIC)

    @property
    def likes_count(self):
        return self.likes.count()

    @property
    def comments_count(self):
        return self.comments.count()


class PublicationComment(models.Model):
    author = models.ForeignKey('profiles.Profile', null=True)
    content = models.TextField(max_length=500, blank=False)
    date_posted = models.DateTimeField(auto_now_add=True)
    publication = models.ForeignKey(Publication, related_name='comments')


class PublicationLike(models.Model):
    author = models.ForeignKey('profiles.Profile', null=True)
    publication = models.ForeignKey(Publication, related_name='likes')
{'fraction_non_alphanumeric': 0.11173498034811903, 'fraction_numerical': 0.010668163952835485, 'mean_word_length': 4.97986577181208, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1323816', 'n_tokens_mistral': 546, 'n_tokens_neox': 506, 'n_words': 94}