Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null=True should not be added to CurrencyField (2.1.1 > 3.0) #702

Open
flc opened this issue Apr 19, 2023 · 1 comment
Open

null=True should not be added to CurrencyField (2.1.1 > 3.0) #702

flc opened this issue Apr 19, 2023 · 1 comment

Comments

@flc
Copy link

flc commented Apr 19, 2023

Hi, after upgrading from 2.1.1 to 3.0 makemigrations detects a change for all MoneyField fields declared in a similar way like this:

    min_order_fee = MoneyField(
        _('min_order_fee'),
        max_digits=10,
        decimal_places=2,
        default_currency=settings.DEFAULT_CURRENCY,
        null=True, blank=True,
    )

The created migration:

operations = [
        migrations.AlterField(
            model_name='supplier',
            name='min_order_fee_currency',
            field=djmoney.models.fields.CurrencyField(choices=[('CHF', 'CHF'), ('EUR', 'EUR'), ('GBP', 'GBP'), ('USD', 'USD')], default='USD', editable=False, max_length=3, null=True),
        ),
    ]

The change it detects is that it wants to add null=True to the CurrencyField which is strange because the currency field is a CharField subclass so it should not be nullable. However the MoneyField/DecimalField I'd like to keep as nullable.

@benjaoming
Copy link
Contributor

because the currency field is a CharField subclass so it should not be nullable.

I can't really grasp everything about this issue, but please have a look here: #672 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants