<commit_before>from django.db import models

# Create your models here.

class Tag(models.Model):
    name = models.CharField(max_length=300)
    slug = models.SlugField()
    def __unicode__(self):
        return self.name
    def get_absolute_url(self):
        return '/tag/' + self.slug + '/1/'

class Post(models.Model):
    HIDDEN = 0
    PREVIEW = 1
    PUBLISHED = 2
    STATES = (
        (HIDDEN, 'Hidden'),
        (PREVIEW, 'Preview'),
        (PUBLISHED, 'Published'),
        )
    datePosted = models.DateTimeField(null=True)
    lastUpdated = models.DateTimeField(auto_now=True)
    state = models.IntegerField(choices=STATES)
    slug = models.SlugField()
    title = models.CharField(max_length=300)
    text = models.TextField(blank=True)
    excerpt = models.TextField(blank=True)
    tags = models.ManyToManyField(Tag, related_name="posts")
    def get_absolute_url(self):
        return '/' + self.slug
    def get_edit_url(self):
        return '/admin/posts/post/' + str(self.id) + '/'
    def __unicode__(self):
        return self.title

class Comment(models.Model):
    post = models.ForeignKey(Post, related_name='comments')
    name = models.CharField(max_length=300)
    email = models.CharField(max_length=300, blank=True)
    date = models.DateTimeField(auto_now_add=True)
    text = models.TextField()
    spam = models.BooleanField()
    subscribed = models.BooleanField()
    def get_absolute_url(self):
        return self.post.get_absolute_url() + '#comment-' + self.id
    def __unicode__(self):
        ret = u'"%s" by %s' % (self.text[:30], self.email)
        if self.spam:
            ret += u' [SPAM]'
        return ret<commit_msg>emails cannot be blank<commit_after>from django.db import models

# Create your models here.

class Tag(models.Model):
    name = models.CharField(max_length=300)
    slug = models.SlugField()
    def __unicode__(self):
        return self.name
    def get_absolute_url(self):
        return '/tag/' + self.slug + '/1/'

class Post(models.Model):
    HIDDEN = 0
    PREVIEW = 1
    PUBLISHED = 2
    STATES = (
        (HIDDEN, 'Hidden'),
        (PREVIEW, 'Preview'),
        (PUBLISHED, 'Published'),
        )
    datePosted = models.DateTimeField(null=True)
    lastUpdated = models.DateTimeField(auto_now=True)
    state = models.IntegerField(choices=STATES)
    slug = models.SlugField()
    title = models.CharField(max_length=300)
    text = models.TextField(blank=True)
    excerpt = models.TextField(blank=True)
    tags = models.ManyToManyField(Tag, related_name="posts")
    def get_absolute_url(self):
        return '/' + self.slug
    def get_edit_url(self):
        return '/admin/posts/post/' + str(self.id) + '/'
    def __unicode__(self):
        return self.title

class Comment(models.Model):
    post = models.ForeignKey(Post, related_name='comments')
    name = models.CharField(max_length=300)
    email = models.CharField(max_length=300)
    date = models.DateTimeField(auto_now_add=True)
    text = models.TextField()
    spam = models.BooleanField()
    subscribed = models.BooleanField()
    def get_absolute_url(self):
        return self.post.get_absolute_url() + '#comment-' + self.id
    def __unicode__(self):
        ret = u'"%s" by %s' % (self.text[:30], self.email)
        if self.spam:
            ret += u' [SPAM]'
        return ret
{'fraction_non_alphanumeric': 0.12966835972512697, 'fraction_numerical': 0.01075590080669256, 'mean_word_length': 2.980975029726516, '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': '6910634', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1070, 'n_words': 218}