<commit_before>from django.db import models


class Currency(models.Model):
    name = models.CharField(max_length=25)
    contraction = models.CharField(max_length=5)

    def __str__(self):
        return self.name


class Account(models.Model):
    DEFAULT_CURRENCY_ID = 1  # pounds ?
    BANK = 'b'
    CASH = 'c'
    TYPE_CHOICES = (
        (BANK, 'Bank'),
        (CASH, 'Cash'),
    )
    account_type = models.CharField(max_length=5, choices=TYPE_CHOICES, default=CASH)
    bank_name = models.CharField(max_length=25, blank=True)
    number = models.CharField(max_length=140, blank=True, unique=True)
    balance = models.DecimalField(decimal_places=10, max_digits=19, default=0)
    currency = models.ForeignKey(Currency, default=DEFAULT_CURRENCY_ID)
    active = models.BooleanField(default=True)
    # add the account owner

    def __str__(self):
        if self.account_type == 'b':
            return self.number
        else:
            return self.currency


class Transfer(models.Model):
    from_account = models.ForeignKey(Account, related_name="from_account")
    to_account = models.ForeignKey(Account, related_name="to_account")
    amount = models.DecimalField(decimal_places=10, max_digits=19)
    exchange_rate = models.DecimalField(decimal_places=10, max_digits=19)
    date = models.DateTimeField()

    def __str__(self):
        return self.amount<commit_msg>Fixes Bug, Account __str__ returned Currency Object instead of currency.name<commit_after>from django.db import models


class Currency(models.Model):
    name = models.CharField(max_length=25)
    contraction = models.CharField(max_length=5)

    def __str__(self):
        return self.name


class Account(models.Model):
    DEFAULT_CURRENCY_ID = 1  # pounds ?
    BANK = 'b'
    CASH = 'c'
    TYPE_CHOICES = (
        (BANK, 'Bank'),
        (CASH, 'Cash'),
    )
    account_type = models.CharField(max_length=5, choices=TYPE_CHOICES, default=CASH)
    bank_name = models.CharField(max_length=25, blank=True)
    number = models.CharField(max_length=140, blank=True, unique=True)
    balance = models.DecimalField(decimal_places=10, max_digits=19, default=0)
    currency = models.ForeignKey('Currency', default=DEFAULT_CURRENCY_ID)
    active = models.BooleanField(default=True)
    # add the account owner

    def __str__(self):
        if self.account_type == 'b':
            return self.number
        else:
            return self.currency.name


class Transfer(models.Model):
    from_account = models.ForeignKey(Account, related_name="from_account")
    to_account = models.ForeignKey(Account, related_name="to_account")
    amount = models.DecimalField(decimal_places=10, max_digits=19)
    exchange_rate = models.DecimalField(decimal_places=10, max_digits=19)
    date = models.DateTimeField()

    def __str__(self):
        return self.amount
{'fraction_non_alphanumeric': 0.10701754385964912, 'fraction_numerical': 0.016140350877192983, 'mean_word_length': 3.7201986754966887, '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': '773948', 'n_tokens_mistral': 943, 'n_tokens_neox': 900, 'n_words': 172}