[ad_1]
I have a probleme to link my django application to my postgresql database. I have create a custom type currencies in postgresql and I use it as an array.
// Type
create type currencies as enum ('EUR');
// Usage
currencies currencies[] not null
In Django, I have made a Enum Currencies ans try to use it as a choices in a Charfield with no succes using the doc..
The django doc about Arrayfield
class Currencies(models.TextChoices):
EURO = 'EUR', 'euro'
from django.contrib.postgres.fields import ArrayField
currencies = ArrayField(
base_field=models.CharField(
choices=Currencies.choices,
max_length=3
),
default=list
)
[ad_2]