<commit_before>import os
import zipfile

from datetime import datetime
import Image

from django.db import models
from django.db.models import signals
from django.conf import settings
from django.utils.functional import curry
from django.core.validators import ValidationError
from django.core.urlresolvers import reverse
from django.dispatch import dispatcher
from django.template.defaultfilters import slugify

# Get relative media path
try:
    PHOTOLOGUE_DIR = settings.PHOTOLOGUE_DIR
except:
    PHOTOLOGUE_DIR = 'photologue'


class Gallery(models.Model):
    pub_date = models.DateTimeField("Date published", default=datetime.now)
    title = models.CharField(maxlength=200)
    slug = models.SlugField(prepopulate_from=('title',),
                            help_text='A "Slug" is a unique URL-friendly title for an object.')
    description = models.TextField()
    is_public = models.BooleanField(default=True,
                                    help_text="Public galleries will be displayed in the default views.")
    photos = models.ManyToManyField('Photo', related_name='galleries')

    class Meta:
        ordering = ['-pub_date']
        get_latest_by = 'pub_date'
        verbose_name_plural = "galleries"

    class Admin:
        list_display = ('title', 'pub_date', 'photo_count', 'is_public')
        list_filter = ['pub_date', 'is_public']
        date_hierarchy = 'pub_date'

    def __unicode__(self):
        return self.title

    def get_absolute_url(self):
        args = self.pub_date.strftime("%Y/%b/%d").lower().split("/") + [self.slug]
        return reverse('pl-gallery-detail', args=args)

    def latest(self, limit=5):
        return self.photos.all()[:limit]

    def photo_count(self):
        return self.photos.all().count()
    photo_count.short_description = 'Count'


class GalleryUpload(models.Model):
    zip_file = models.FileField('Images file (.zip)',
                                upload_to=PHOTOLOGUE_DIR+"/temp",
                                help_text="Select a .zip file of images to upload into a new Gallery.")
    title_prefix = models.CharField(maxlength=75,
                                    help_text="Photos will be titled using this prefix.")
    caption = models.TextField(help_text="Caption will be added to all photos.")<commit_msg>Reverted previous commit. I believe it may cause issues with mysql which I do not have installed here to test.<commit_after>import os
import zipfile

from datetime import datetime
import Image

from django.db import models
from django.db.models import signals
from django.conf import settings
from django.utils.functional import curry
from django.core.validators import ValidationError
from django.core.urlresolvers import reverse
from django.dispatch import dispatcher
from django.template.defaultfilters import slugify

# Get relative media path
try:
    PHOTOLOGUE_DIR = settings.PHOTOLOGUE_DIR
except:
    PHOTOLOGUE_DIR = 'photologue'


class Gallery(models.Model):
    pub_date = models.DateTimeField("Date published", default=datetime.now)
    title = models.CharField(maxlength=200)
    slug = models.SlugField(prepopulate_from=('title',),
                            help_text='A "Slug" is a unique URL-friendly title for an object.')
    description = models.TextField()
    is_public = models.BooleanField(default=True,
                                    help_text="Public galleries will be displayed in the default views.")
    photos = models.ManyToManyField('Photo', related_name='galleries')

    class Meta:
        ordering = ['-pub_date']
        get_latest_by = 'pub_date'
        verbose_name_plural = "galleries"

    class Admin:
        list_display = ('title', 'pub_date', 'photo_count', 'is_public')
        list_filter = ['pub_date', 'is_public']
        date_hierarchy = 'pub_date'

    def __unicode__(self):
        return self.title

    def get_absolute_url(self):
        args = self.pub_date.strftime("%Y/%b/%d").lower().split("/") + [self.slug]
        return reverse('pl-gallery-detail', args=args)

    def latest(self, limit=5):
        return self.photos.all()[:limit]

    def photo_count(self):
        return self.photos.all().count()
    photo_count.short_description = 'Count'


class GalleryUpload(models.Model):
    id = models.IntegerField(default=1, editable=False, primary_key=True)
    zip_file = models.FileField('Images file (.zip)',
                                upload_to=PHOTOLOGUE_DIR+"/temp",
                                help_text="Select a .zip file of images to upload into a new Gallery.")
    title_prefix = models.CharField(maxlength=75,
                                    help_text="Photos will be titled using this prefix.")
    caption = models.TextField(help_text="Caption will be added to all photos.")
{'fraction_non_alphanumeric': 0.0993516000836645, 'fraction_numerical': 0.002719096423342397, 'mean_word_length': 3.0320404721753795, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3265657', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1310, 'n_words': 356}