<commit_before>from django.core.urlresolvers import reverse
from django.db import models
from django_thumbs.db.models import ImageWithThumbsField
from multilingual_model.models import MultilingualModel, MultilingualTranslation

from news.fields import UniqueBooleanField
from news.constants import GRAPHIC_SIZES


class Author(models.Model):
    name = models.CharField(max_length=255)

    def __unicode__(self):
        return self.name


class Category(MultilingualModel):
    graphic = models.ImageField(upload_to='graphics')

    class Meta:
        verbose_name_plural = 'Categories'

    def __unicode__(self):
        return self.name

    def get_absolute_url(self):
        return reverse('category-detail', args=[self.slug])


class CategoryTranslation(MultilingualTranslation):
    parent = models.ForeignKey(Category, related_name='translations')
    name = models.CharField(max_length=20)
    slug = models.SlugField()
    description = models.CharField(max_length=255)

    class Meta:
        unique_together = ('parent', 'language_code')


class ArticleManager(models.Manager):
    def get_recent(self, n=0, show_lead_story=True):
        if show_lead_story:
            articles = self
        else:
            articles = self.filter(is_lead_story=False)

        articles = articles.order_by('-created_on')

        if n > 0:
            return articles[:n]
        else:
            return articles


class Article(MultilingualModel):
    objects = ArticleManager()
    author = models.ForeignKey(Author)
    created_on = models.DateTimeField(auto_now_add=True)
    modified_on = models.DateTimeField(auto_now=True)
    category = models.ForeignKey(Category)
    graphic = ImageWithThumbsField(upload_to='graphics', sizes=GRAPHIC_SIZES)
    is_lead_story = UniqueBooleanField()

    def __unicode__(self):
        return "%s by %s [%s]" % (self.title, self.author, self.category)

    def get_absolute_url(self):
        return reverse('article-detail', args=[self.slug])


class ArticleTranslation(MultilingualTranslation):
    parent = models.ForeignKey(Article, related_name='translations')
    title = models.CharField(max_length=100)
    description = models.CharField(max_length=255)
    content = models.TextField()
    slug = models.SlugField()

    class Meta:
        unique_together = ('parent', 'language_code')
<commit_msg>Convert description on Category into a TextField<commit_after>from django.core.urlresolvers import reverse
from django.db import models
from django_thumbs.db.models import ImageWithThumbsField
from multilingual_model.models import MultilingualModel, MultilingualTranslation

from news.fields import UniqueBooleanField
from news.constants import GRAPHIC_SIZES


class Author(models.Model):
    name = models.CharField(max_length=255)

    def __unicode__(self):
        return self.name


class Category(MultilingualModel):
    graphic = models.ImageField(upload_to='graphics')

    class Meta:
        verbose_name_plural = 'Categories'

    def __unicode__(self):
        return self.name

    def get_absolute_url(self):
        return reverse('category-detail', args=[self.slug])


class CategoryTranslation(MultilingualTranslation):
    parent = models.ForeignKey(Category, related_name='translations')
    name = models.CharField(max_length=20)
    slug = models.SlugField()
    description = models.TextField()

    class Meta:
        unique_together = ('parent', 'language_code')


class ArticleManager(models.Manager):
    def get_recent(self, n=0, show_lead_story=True):
        if show_lead_story:
            articles = self
        else:
            articles = self.filter(is_lead_story=False)

        articles = articles.order_by('-created_on')

        if n > 0:
            return articles[:n]
        else:
            return articles


class Article(MultilingualModel):
    objects = ArticleManager()
    author = models.ForeignKey(Author)
    created_on = models.DateTimeField(auto_now_add=True)
    modified_on = models.DateTimeField(auto_now=True)
    category = models.ForeignKey(Category)
    graphic = ImageWithThumbsField(upload_to='graphics', sizes=GRAPHIC_SIZES)
    is_lead_story = UniqueBooleanField()

    def __unicode__(self):
        return "%s by %s [%s]" % (self.title, self.author, self.category)

    def get_absolute_url(self):
        return reverse('article-detail', args=[self.slug])


class ArticleTranslation(MultilingualTranslation):
    parent = models.ForeignKey(Article, related_name='translations')
    title = models.CharField(max_length=100)
    description = models.CharField(max_length=255)
    content = models.TextField()
    slug = models.SlugField()

    class Meta:
        unique_together = ('parent', 'language_code')

{'fraction_non_alphanumeric': 0.0952481520591341, 'fraction_numerical': 0.006124604012671594, 'mean_word_length': 3.8474923234390994, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '55595', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1328, 'n_words': 284}