-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodels.py
More file actions
54 lines (47 loc) · 1.61 KB
/
models.py
File metadata and controls
54 lines (47 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from django.db import models
from django.utils.translation import gettext as _
def get_currencies():
return (
("AUD", "Australian dollar"),
("BRL", "Brazilian real 2"),
("CAD", "Canadian dollar"),
("CNY", "Chinese Renmenbi 3"),
("CZK", "Czech koruna"),
("DKK", "Danish krone"),
("EUR", "Euro"),
("HKD", "Hong Kong dollar"),
("HUF", "Hungarian forint 1"),
("ILS", "Israeli new shekel"),
("JPY", "Japanese yen 1"),
("MYR", "Malaysian ringgit 3"),
("MXN", "Mexican peso"),
("TWD", "New Taiwan dollar 1"),
("NZD", "New Zealand dollar"),
("NOK", "Norwegian krone"),
("PHP", "Philippine peso"),
("PLN", "Polish złoty"),
("GBP", "Pound sterling"),
("RUB", "Russian ruble"),
("SGD", "Singapore dollar"),
("SEK", "Swedish krona"),
("CHF", "Swiss franc"),
("THB", "Thai baht"),
("USD", "United States dollar"),
)
# Create your models here.
#class Pay(models.Model):
#include_in_migrations = False
#test = models.CharField(max_length=10, default="holas")
# class Meta:
# verbose_name = "Payment Method"
# verbose_name_plural = "Payments Methods"
class Currency(models.Model):
name = models.CharField(_("Currency representation"), max_length=3, choices=get_currencies(), default="")
@classmethod
def get_default(cls, ):
return cls.objects.first()
def __str__(self):
return self.name
class Meta:
verbose_name = _("Currency")
verbose_name_plural = _("Currencies")