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


class Category(models.Model):

    name = models.CharField(max_length=256)
    slug_name = models.SlugField()

    def save(self, *args, **kwargs):
        self.slug_name = slugify(self.name)
        return super(Category, self).save(*args, **kwargs)


class ContentImage(models.Model):

    name = models.CharField(max_length=256)
    image = models.ImageField(upload_to='images')


class Content(models.Model):

    category = models.ForeignKey(Category)
    title = models.CharField(max_length=256)
    description = models.TextField()
    images = models.ManyToManyField(ContentImage)
    created = models.DateTimeField()
    modified = models.DateTimeField()
    views = models.IntegerField(default=0)

    def save(self, *args, **kwargs):
        if not self.id:
            self.created = timezone.now()
        self.modified = timezone.now()
        return super(Content, self).save(*args, **kwargs)<commit_msg>Added 'rating' field in Content model.<commit_after>from django.db import models
from django.template.defaultfilters import slugify
from django.utils import timezone


class Category(models.Model):

    name = models.CharField(max_length=256)
    slug_name = models.SlugField()

    def save(self, *args, **kwargs):
        self.slug_name = slugify(self.name)
        return super(Category, self).save(*args, **kwargs)


class ContentImage(models.Model):

    name = models.CharField(max_length=256)
    image = models.ImageField(upload_to='images')


class Content(models.Model):

    category = models.ForeignKey(Category)
    title = models.CharField(max_length=256)
    description = models.TextField()
    images = models.ManyToManyField(ContentImage)
    created = models.DateTimeField()
    modified = models.DateTimeField()
    views = models.IntegerField(default=0)
    rating = models.IntegerField(default=0)

    def save(self, *args, **kwargs):
        if not self.id:
            self.created = timezone.now()
        self.modified = timezone.now()
        return super(Content, self).save(*args, **kwargs)
{'fraction_non_alphanumeric': 0.11710465652374366, 'fraction_numerical': 0.009681881051175657, 'mean_word_length': 3.769230769230769, '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': '3988334', 'n_tokens_mistral': 655, 'n_tokens_neox': 623, 'n_words': 136}