<commit_before>from django.db import models
from django.template.defaultfilters import slugify

import tagging


class Category(models.Model):
    title = models.CharField(max_length=100)
    slug = models.SlugField(unique=True)

    class Meta:
        verbose_name_plural = 'Categories'
        ordering = ('title',)

    def save(self):
        if not self.pk:
            self.slug = slugify(self.title)
        super(Category, self).save()

    def __unicode__(self):
        return self.title



class Entry(models.Model):
    class Status:
        LIVE = 1
        PENDING = 2
        CHOICES = (
            (LIVE, 'Live'),
            (PENDING, 'Pending'),
            )
    name = models.CharField(max_length=256)
    slug = models.SlugField(max_length=256, unique=True)
    author = models.ForeignKey('auth.user')
    content = models.TextField()
    status = models.IntegerField(choices=Status.CHOICES,
                                 default=Status.PENDING)
    allow_comments = models.BooleanField(default=True)
    publish = models.DateTimeField(blank=True, null=True)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)
    recipes = models.ManyToManyField('recipes.Recipe', related_name='entries', blank=True, null=True)
    categories = models.ManyToManyField(Category, related_name='entries', blank=True, null=True)

    class Meta:
        verbose_name_plural = 'Entries'
        ordering = ('-publish',)


    def save(self):
        if not self.pk:
            self.slug = slugify(self.name)
        super(Entry, self).save()


    def __unicode__(self):
        return self.name

    @models.permalink
    def get_absolute_url(self):
        return ('entry_detail', (), {
                'year': self.publish.year,<commit_msg>args and kwargs are needed for overriding save()<commit_after>from django.db import models
from django.template.defaultfilters import slugify

import tagging


class Category(models.Model):
    title = models.CharField(max_length=100)
    slug = models.SlugField(unique=True)

    class Meta:
        verbose_name_plural = 'Categories'
        ordering = ('title',)

    def save(self, *args, **kwarg):
        if not self.pk:
            self.slug = slugify(self.title)
        super(Category, self).save(*args, **kwarg)

    def __unicode__(self):
        return self.title



class Entry(models.Model):
    class Status:
        LIVE = 1
        PENDING = 2
        CHOICES = (
            (LIVE, 'Live'),
            (PENDING, 'Pending'),
            )
    name = models.CharField(max_length=256)
    slug = models.SlugField(max_length=256, unique=True)
    author = models.ForeignKey('auth.user')
    content = models.TextField()
    status = models.IntegerField(choices=Status.CHOICES,
                                 default=Status.PENDING)
    allow_comments = models.BooleanField(default=True)
    publish = models.DateTimeField(blank=True, null=True)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)
    recipes = models.ManyToManyField('recipes.Recipe', related_name='entries', blank=True, null=True)
    categories = models.ManyToManyField(Category, related_name='entries', blank=True, null=True)

    class Meta:
        verbose_name_plural = 'Entries'
        ordering = ('-publish',)


    def save(self, *args, **kwarg):
        if not self.pk:
            self.slug = slugify(self.name)
        super(Entry, self).save(*args, **kwarg)


    def __unicode__(self):
        return self.name

    @models.permalink
    def get_absolute_url(self):
        return ('entry_detail', (), {
                'year': self.publish.year,
{'fraction_non_alphanumeric': 0.11510402593893543, 'fraction_numerical': 0.005944339367738449, 'mean_word_length': 2.7243460764587524, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1917920', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1093, 'n_words': 222}