-
Notifications
You must be signed in to change notification settings - Fork 5.4k
/
models.py
37 lines (32 loc) · 1.15 KB
/
models.py
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
from django.conf import settings
from django.db import models
from django_countries.fields import CountryField
from ..core.permissions import ChannelPermissions
from . import AllocationStrategy
class Channel(models.Model):
name = models.CharField(max_length=250)
is_active = models.BooleanField(default=False)
slug = models.SlugField(max_length=255, unique=True)
currency_code = models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH)
default_country = CountryField()
allocation_strategy = models.CharField(
max_length=255,
choices=AllocationStrategy.CHOICES,
default=AllocationStrategy.PRIORITIZE_SORTING_ORDER,
)
automatically_confirm_all_new_orders = models.BooleanField(default=True, null=True)
automatically_fulfill_non_shippable_gift_card = models.BooleanField(
default=True,
null=True,
)
class Meta:
ordering = ("slug",)
app_label = "channel"
permissions = (
(
ChannelPermissions.MANAGE_CHANNELS.codename,
"Manage channels.",
),
)
def __str__(self):
return self.slug