<commit_before>import PIL
import os
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.html import strip_tags

# Create your models here.

class GallerySection(models.Model):
    title = models.CharField(max_length=100)
    position = models.IntegerField()
    slug = models.SlugField()
    description = models.TextField(blank=True)

    def text_title(self):
        return strip_tags(self.title)

    def __unicode__(self):
        return self.title

    def get_absolute_url(self):
        return reverse("gallery-gallery", kwargs={"slug": self.slug})


class Image(models.Model):
    image = models.ImageField(upload_to="images/gallery/",
                              height_field="height", width_field="width")
    thumbnail = models.ImageField(upload_to="images/gallery/thumbs/",
                                  editable=False)
    scaled = models.ImageField(upload_to="images/gallery/scaled/",
                               editable=False, null=True, blank=True)
    gallery = models.ForeignKey(GallerySection, null=True, blank=True)
    description = models.TextField(null=True, blank=True)
    width = models.IntegerField(editable=False)
    height = models.IntegerField(editable=False)

    def get_absolute_url(self):
        return self.image.url

    def save(self, *args, **kwargs):
        try:<commit_msg>Extra filed on the gallery.<commit_after>import PIL
import os
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.html import strip_tags

# Create your models here.

class GallerySection(models.Model):
    title = models.CharField(max_length=100)
    position = models.IntegerField()
    slug = models.SlugField()
    description = models.TextField(blank=True)
    listed = models.BooleanField(default=True)

    def text_title(self):
        return strip_tags(self.title)

    def __unicode__(self):
        return self.title

    def get_absolute_url(self):
        return reverse("gallery-gallery", kwargs={"slug": self.slug})


class Image(models.Model):
    image = models.ImageField(upload_to="images/gallery/",
                              height_field="height", width_field="width")
    thumbnail = models.ImageField(upload_to="images/gallery/thumbs/",
                                  editable=False)
    scaled = models.ImageField(upload_to="images/gallery/scaled/",
                               editable=False, null=True, blank=True)
    gallery = models.ForeignKey(GallerySection, null=True, blank=True)
    description = models.TextField(null=True, blank=True)
    width = models.IntegerField(editable=False)
    height = models.IntegerField(editable=False)

    def get_absolute_url(self):
        return self.image.url

    def save(self, *args, **kwargs):
        try:
{'fraction_non_alphanumeric': 0.10661896243291592, 'fraction_numerical': 0.002146690518783542, 'mean_word_length': 3.148367952522255, 'pattern_counts': {'":': 2, '<': 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': '6318112', 'n_tokens_mistral': 814, 'n_tokens_neox': 789, 'n_words': 161}