<commit_before>from django.db import models
from django.db.models import Count, Sum
from django.db.models.deletion import SET_NULL
from django.template.defaultfilters import slugify
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now

from django_extensions.db.fields import (ModificationDateTimeField,
                                         CreationDateTimeField)
from djchoices.choices import DjangoChoices, ChoiceItem
from parler.models import TranslatableModel, TranslatedFields
from sorl.thumbnail import ImageField

from bluebottle.tasks.models import TaskMember
from bluebottle.utils.fields import MoneyField, PrivateFileField
from bluebottle.utils.utils import StatusDefinition


class ProjectTheme(TranslatableModel):

    """ Themes for Projects. """

    # The name is marked as unique so that users can't create duplicate
    # theme names.
    slug = models.SlugField(_('slug'), max_length=100, unique=True)
    disabled = models.BooleanField(_('disabled'), default=False)

    translations = TranslatedFields(
        name=models.CharField(_('name'), max_length=100),
        description=models.TextField(_('description'), blank=True)
    )

    def __unicode__(self):
        return self.name

    def save(self, **kwargs):
        if not self.slug:
            self.slug = slugify(self.name)

        super(ProjectTheme, self).save(**kwargs)

    class Meta:
        ordering = ['slug']
        verbose_name = _('project theme')
        verbose_name_plural = _('project themes')
        permissions = (
            ('api_read_projecttheme', 'Can view project theme through API'),
        )


class ProjectPhase(TranslatableModel):

    """ Phase of a project """

    slug = models.SlugField(max_length=200, unique=True)
    sequence = models.IntegerField(unique=True,
                                   help_text=_('For ordering phases.'))

    active = models.BooleanField(default=True,
                                 help_text=_('Whether this phase is in use or '
                                             'has been discarded.'))
    editable = models.BooleanField(default=True,
                                   help_text=_('Whether the project owner can '
                                               'change the details of the'
                                               'project.'))
    viewable = models.BooleanField(default=True,
                                   help_text=_('Whether this phase, and '
                                               'projects in it show up at the '
                                               'website'))
    owner_editable = models.BooleanField(default=False,
                                         help_text=_('The owner can manually '
                                                     'select between these '
                                                     'phases'))

    translations = TranslatedFields(
        name=models.CharField(_('name'), max_length=100),
        description=models.TextField(_('description'), blank=True)
    )

    class Meta():
        verbose_name = _('project theme')
        verbose_name_plural = _('project themes')
        ordering = ['sequence']
        permissions = (
            ('api_read_projectphase', 'Can view project phase through API'),
        )

    def __unicode__(self):
        return u'{0} - {1}'.format(self.sequence, self.name)

    def save(self, *args, **kwargs):
        if not self.slug:
            self.slug = slugify(self.name)
        super(ProjectPhase, self).save(*args, **kwargs)


class BaseProjectDocument(models.Model):

    """ Document for an Project """
<commit_msg>Correct project phase verbose name<commit_after>from django.db import models
from django.db.models import Count, Sum
from django.db.models.deletion import SET_NULL
from django.template.defaultfilters import slugify
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now

from django_extensions.db.fields import (ModificationDateTimeField,
                                         CreationDateTimeField)
from djchoices.choices import DjangoChoices, ChoiceItem
from parler.models import TranslatableModel, TranslatedFields
from sorl.thumbnail import ImageField

from bluebottle.tasks.models import TaskMember
from bluebottle.utils.fields import MoneyField, PrivateFileField
from bluebottle.utils.utils import StatusDefinition


class ProjectTheme(TranslatableModel):

    """ Themes for Projects. """

    # The name is marked as unique so that users can't create duplicate
    # theme names.
    slug = models.SlugField(_('slug'), max_length=100, unique=True)
    disabled = models.BooleanField(_('disabled'), default=False)

    translations = TranslatedFields(
        name=models.CharField(_('name'), max_length=100),
        description=models.TextField(_('description'), blank=True)
    )

    def __unicode__(self):
        return self.name

    def save(self, **kwargs):
        if not self.slug:
            self.slug = slugify(self.name)

        super(ProjectTheme, self).save(**kwargs)

    class Meta:
        ordering = ['slug']
        verbose_name = _('project theme')
        verbose_name_plural = _('project themes')
        permissions = (
            ('api_read_projecttheme', 'Can view project theme through API'),
        )


class ProjectPhase(TranslatableModel):

    """ Phase of a project """

    slug = models.SlugField(max_length=200, unique=True)
    sequence = models.IntegerField(unique=True,
                                   help_text=_('For ordering phases.'))

    active = models.BooleanField(default=True,
                                 help_text=_('Whether this phase is in use or '
                                             'has been discarded.'))
    editable = models.BooleanField(default=True,
                                   help_text=_('Whether the project owner can '
                                               'change the details of the'
                                               'project.'))
    viewable = models.BooleanField(default=True,
                                   help_text=_('Whether this phase, and '
                                               'projects in it show up at the '
                                               'website'))
    owner_editable = models.BooleanField(default=False,
                                         help_text=_('The owner can manually '
                                                     'select between these '
                                                     'phases'))

    translations = TranslatedFields(
        name=models.CharField(_('name'), max_length=100),
        description=models.TextField(_('description'), blank=True)
    )

    class Meta():
        verbose_name = _('project phase')
        verbose_name_plural = _('project phase')
        ordering = ['sequence']
        permissions = (
            ('api_read_projectphase', 'Can view project phase through API'),
        )

    def __unicode__(self):
        return u'{0} - {1}'.format(self.sequence, self.name)

    def save(self, *args, **kwargs):
        if not self.slug:
            self.slug = slugify(self.name)
        super(ProjectPhase, self).save(*args, **kwargs)


class BaseProjectDocument(models.Model):

    """ Document for an Project """

{'fraction_non_alphanumeric': 0.09117725931885223, 'fraction_numerical': 0.0037543577366586215, 'mean_word_length': 2.058220582205822, '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': 44, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1985440', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1778, 'n_words': 478}