<commit_before>from django.db import models
from model_utils.managers import InheritanceManager

# Create your models here.
class Account(models.Model):
    label = models.CharField(max_length=100)
    currency = models.CharField(max_length=3)
    balance = models.DecimalField(max_digits=10,decimal_places=2,default=0)

    def __str__(self):
        return "<Account : "+self.label+">"

class Category(models.Model):
    label = models.CharField(max_length=50)
    parent = models.ForeignKey("self",related_name="parent_category",default=None, blank=True, null=True)

    class Meta:
        verbose_name_plural = "categories"

    def __str__(self):
        return "<Category : "+self.label+">"

class Transaction(models.Model):
    amount = models.DecimalField(max_digits=10,decimal_places=2,default=0)
    time_of_transaction = models.DateTimeField()
    category = models.ForeignKey(Category,default=None, blank=True, null=True)
    is_reconciled = models.BooleanField(default=False)
    currency = models.CharField(max_length=3,default=None, blank=True, null=True)

    #This is so I can find type when displaying on template
    def type_of_transaction(self):
        return self.__class__.__name__

    objects = InheritanceManager()

class Transfer(Transaction):
    from_account = models.ForeignKey(Account,related_name='from_account')
    to_account = models.ForeignKey(Account,related_name='to_account')

    def __str__(self):<commit_msg>changing type to a property to use in template<commit_after>from django.db import models
from model_utils.managers import InheritanceManager

# Create your models here.
class Account(models.Model):
    label = models.CharField(max_length=100)
    currency = models.CharField(max_length=3)
    balance = models.DecimalField(max_digits=10,decimal_places=2,default=0)

    def __str__(self):
        return "<Account : "+self.label+">"

class Category(models.Model):
    label = models.CharField(max_length=50)
    parent = models.ForeignKey("self",related_name="parent_category",default=None, blank=True, null=True)

    class Meta:
        verbose_name_plural = "categories"

    def __str__(self):
        return "<Category : "+self.label+">"

class Transaction(models.Model):
    amount = models.DecimalField(max_digits=10,decimal_places=2,default=0)
    time_of_transaction = models.DateTimeField()
    category = models.ForeignKey(Category,default=None, blank=True, null=True)
    is_reconciled = models.BooleanField(default=False)
    currency = models.CharField(max_length=3,default=None, blank=True, null=True)

    #This is so I can find type when displaying on template
    @property
    def type_of_transaction(self):
        return self.__class__.__name__

    objects = InheritanceManager()

class Transfer(Transaction):
    from_account = models.ForeignKey(Account,related_name='from_account')
    to_account = models.ForeignKey(Account,related_name='to_account')

    def __str__(self):
{'fraction_non_alphanumeric': 0.10809894950864114, 'fraction_numerical': 0.010166045408336157, 'mean_word_length': 5.0, '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': '1416769', 'n_tokens_mistral': 909, 'n_tokens_neox': 870, 'n_words': 174}