<commit_before>from decimal import Decimal

from django.db import models
from django.utils.translation import ugettext as _
from django.core.exceptions import ValidationError

from django_extensions.db.fields import (
    ModificationDateTimeField, CreationDateTimeField
)

from djchoices import DjangoChoices, ChoiceItem

from apps.bluebottle_utils.fields import MoneyField


class Donation(models.Model):
    """
    Donation of an amount from a user to one or multiple projects through
    DonationLine objects.
    """

    class DonationStatuses(DjangoChoices):
        """
        All legacy values for DonationStatusus.

        TODO: Currently these are related to the payments. This should change
        to information required by the actual use cases
        (ie. payout operations, project and member notifications).
        """
        closed = ChoiceItem('closed', label=_('Closed'))
        expired = ChoiceItem('closed', label=_('Expired'))
        paid = ChoiceItem('closed', label=_('Paid'))
        canceled = ChoiceItem('canceled', label=_('Canceled'))
        chargedback = ChoiceItem('canceled', label=_('Chargedback'))
        new = ChoiceItem('new', label=_('New'))
        started = ChoiceItem('started', label=_('Started'))

    user = models.ForeignKey('auth.User')
    amount = MoneyField(_('amount'))

    status = models.CharField(_('status'),
        max_length=20, choices=DonationStatuses.choices, db_index=True
    )

    created = CreationDateTimeField(_('created'))
    updated = ModificationDateTimeField(_('updated'))

    class Meta:
        verbose_name = _('donation')
        verbose_name_plural = _('donations')


class DonationLine(models.Model):
    """
    DonationLine, allocating part of a Donation to a specific Project.
    """

    donation = models.ForeignKey(Donation)

    project = models.ForeignKey('projects.Project')
    amount = MoneyField(_('amount'))

    created = CreationDateTimeField(_('created'))<commit_msg>Bug: Wrong values for donation status choices.<commit_after>from decimal import Decimal

from django.db import models
from django.utils.translation import ugettext as _
from django.core.exceptions import ValidationError

from django_extensions.db.fields import (
    ModificationDateTimeField, CreationDateTimeField
)

from djchoices import DjangoChoices, ChoiceItem

from apps.bluebottle_utils.fields import MoneyField


class Donation(models.Model):
    """
    Donation of an amount from a user to one or multiple projects through
    DonationLine objects.
    """

    class DonationStatuses(DjangoChoices):
        """
        All legacy values for DonationStatusus.

        TODO: Currently these are related to the payments. This should change
        to information required by the actual use cases
        (ie. payout operations, project and member notifications).
        """
        closed = ChoiceItem('closed', label=_('Closed'))
        expired = ChoiceItem('expired', label=_('Expired'))
        paid = ChoiceItem('paid', label=_('Paid'))
        canceled = ChoiceItem('canceled', label=_('Canceled'))
        chargedback = ChoiceItem('chargedback', label=_('Chargedback'))
        new = ChoiceItem('new', label=_('New'))
        started = ChoiceItem('started', label=_('Started'))

    user = models.ForeignKey('auth.User')
    amount = MoneyField(_('amount'))

    status = models.CharField(_('status'),
        max_length=20, choices=DonationStatuses.choices, db_index=True
    )

    created = CreationDateTimeField(_('created'))
    updated = ModificationDateTimeField(_('updated'))

    class Meta:
        verbose_name = _('donation')
        verbose_name_plural = _('donations')


class DonationLine(models.Model):
    """
    DonationLine, allocating part of a Donation to a specific Project.
    """

    donation = models.ForeignKey(Donation)

    project = models.ForeignKey('projects.Project')
    amount = MoneyField(_('amount'))

    created = CreationDateTimeField(_('created'))
{'fraction_non_alphanumeric': 0.1069545568666834, 'fraction_numerical': 0.0010042681395932714, 'mean_word_length': 3.7315914489311166, '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': '4086295', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1057, 'n_words': 287}