Exemple #1
0
class AbstractMoneyModel(models.Model):
    amount = MoneyField(max_digits=10,
                        decimal_places=2,
                        default_currency='USD')
    m2m_field = models.ManyToManyField(ModelWithDefaultAsInt)

    class Meta:
        abstract = True
Exemple #2
0
        class TestModel(Model):
            field = MoneyField(**field_kwargs)

            class Meta:
                app_label = 'test'
Exemple #3
0
class InheritedMoneyModel(SimpleMoneyModel):
    amount2 = MoneyField(max_digits=10,
                         decimal_places=2,
                         default_currency='USD')
Exemple #4
0
class InheritorMoneyModel(AbstractMoneyModel):
    amount2 = MoneyField(max_digits=10,
                         decimal_places=2,
                         default_currency='USD')
Exemple #5
0
class ModelWithTwoMoneyFields(models.Model):
    amount1 = MoneyField(max_digits=10, decimal_places=2)
    amount2 = MoneyField(max_digits=10, decimal_places=3)
Exemple #6
0
class ModelWithDefaultAsStringWithCurrency(models.Model):
    amount = MoneyField(default='123 EUR', max_digits=10, decimal_places=2)
Exemple #7
0
class NullMoneyFieldModel(models.Model):
    amount = MoneyField(max_digits=10,
                        decimal_places=2,
                        null=True,
                        default_currency='EUR',
                        blank=True)
Exemple #8
0
class ModelWithDefaultAsDecimal(models.Model):
    amount = MoneyField(default=Decimal('0.01'),
                        max_digits=10,
                        decimal_places=2,
                        default_currency='CHF')
Exemple #9
0
class ModelWithDefaultAsMoney(models.Model):
    amount = MoneyField(default=Money('0.01', 'RUB'),
                        max_digits=10,
                        decimal_places=2)
Exemple #10
0
class ModelWithDefaultAsFloat(models.Model):
    amount = MoneyField(default=12.05,
                        max_digits=10,
                        decimal_places=2,
                        default_currency='PLN')
Exemple #11
0
class ModelWithDefaultAsInt(models.Model):
    amount = MoneyField(default=123,
                        max_digits=10,
                        decimal_places=2,
                        default_currency='GHS')
Exemple #12
0
class ModelWithDefaultAsString(models.Model):
    amount = MoneyField(default='123',
                        max_digits=10,
                        decimal_places=2,
                        default_currency='PLN')
Exemple #13
0
class ModelWithCustomManager(models.Model):
    field = MoneyField(max_digits=10, decimal_places=2)

    manager = money_manager(MoneyManager())
Exemple #14
0
class SimpleMoneyModel(models.Model):
    amount = MoneyField(max_digits=10,
                        decimal_places=2,
                        default_currency='EUR')