<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from cms.models.pluginmodel import CMSPlugin
from filer.fields.image import FilerImageField
from jsonfield import JSONField

from .settings import get_setting


@python_2_unicode_compatible
class SlickSlider(CMSPlugin):
    """
    Main Plugin Model for the slider.
    """
    title = models.CharField(
        verbose_name=_('slider title'),
        max_length=255)

    settings = JSONField(
        verbose_name=_('slick settings'),
        default=get_setting('SLICK_SLICKER_DEFAULT_OPTIONS'))

    arrow_color = models.CharField(
        verbose_name=_('arrow color'),
        max_length=255,
        default="#ddd",
        help_text=_('Define the color of slider arrows here. All CSS '
                    'color values work (e.g. #efefef)'))

    def copy_relations(self, oldinstance):
        for image in oldinstance.images.all():
            image.pk = None
            image.slider = self
            image.save()

    def __str__(self):
        """
        String representation of SlickSlider class.
        """
        return "{title}".format(title=self.title)


@python_2_unicode_compatible
class SlickSliderImage(models.Model):
    """
    Image model für SlickSlider class.
    """
    class Meta:
        verbose_name = _('slider image')
        verbose_name_plural = _('slider images')

    slider = models.ForeignKey(
        SlickSlider,
        related_name="images")

    image = FilerImageField(
        verbose_name=_('slider Image'),
        related_name='slider_images_filer')

    link = models.URLField(
        verbose_name=_('image link'),
        null=True, blank=True)

    link_target = models.BooleanField(
        verbose_name=_('image link target'),
        help_text=_('open link in new window'),
        default=True)

    caption_text = models.TextField(
        _('caption text'),
        null=True,
        blank=True)

    def __str__(self):
        """
        String representation of SlickSliderImage class.
        """
        if self.caption_text:
            return self.caption_text
        if self.image.label:
            return self.image.label
        else:
            return "{filename}".format(
                filename=self.image.original_filename)
<commit_msg>updated docs and some refactoring<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from cms.models.pluginmodel import CMSPlugin
from filer.fields.image import FilerImageField
from jsonfield import JSONField

from .settings import get_setting


@python_2_unicode_compatible
class SlickSlider(CMSPlugin):
    """
    Main Plugin Model for the slider.
    """
    class Meta:
        verbose_name = _('slick slider')
        verbose_name_plural = _('slick sliders')

    title = models.CharField(
        verbose_name=_('slider title'),
        max_length=255)

    settings = JSONField(
        verbose_name=_('slick settings'),
        default=get_setting('SLICK_SLICKER_DEFAULT_OPTIONS'),
        help_text=_(
            'Check <a href="http://kenwheeler.github.io/slick/" '
            'target="_blank">'
            'Slick Documentation</a> for possible settings '
            '<br>'
            'Use JSON format and check the errors in the editor<br>'
            'You can also use online JSON validators'))

    arrow_color = models.CharField(
        verbose_name=_('arrow color'),
        max_length=255,
        default="#ddd",
        help_text=_('Define the color of slider arrows here. All CSS '
                    'color values work (e.g. #efefef).'))

    def copy_relations(self, oldinstance):
        for image in oldinstance.images.all():
            image.pk = None
            image.slider = self
            image.save()

    def __str__(self):
        """
        String representation of SlickSlider class.
        """
        return "{title}".format(title=self.title)


@python_2_unicode_compatible
class SlickSliderImage(models.Model):
    """
    Image model für SlickSlider class.
    """
    class Meta:
        verbose_name = _('slider image')
        verbose_name_plural = _('slider images')

    slider = models.ForeignKey(
        SlickSlider,
        related_name="images")

    image = FilerImageField(
        verbose_name=_('slider Image'),
        related_name='slider_images_filer')

    link = models.URLField(
        verbose_name=_('image link'),
        null=True, blank=True)

    link_target = models.BooleanField(
        verbose_name=_('image link target'),
        help_text=_('open link in new window'),
        default=True)

    caption_text = models.TextField(
        _('caption text'),
        null=True,
        blank=True)

    def __str__(self):
        """
        String representation of SlickSliderImage class.
        """
        if self.caption_text:
            return self.caption_text
        if self.image.label:
            return self.image.label
        else:
            return "{filename}".format(
                filename=self.image.original_filename)

{'fraction_non_alphanumeric': 0.0979622359319499, 'fraction_numerical': 0.003739016638624042, 'mean_word_length': 2.4740259740259742, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7127625', 'n_tokens_mistral': 1537, 'n_tokens_neox': 1484, 'n_words': 366}