Customer accounts & Memberships (#2024)

This commit is contained in:
Raphael Michel
2021-05-04 16:56:06 +02:00
committed by GitHub
parent 62e412bbc0
commit 8e79eb570e
116 changed files with 7975 additions and 279 deletions

View File

@@ -514,6 +514,34 @@ class Item(LoggedModel):
'product price.'),
default=False
)
require_membership = models.BooleanField(
verbose_name=_('Require a valid membership'),
default=False,
)
require_membership_types = models.ManyToManyField(
'MembershipType',
verbose_name=_('Allowed membership types'),
blank=True,
)
grant_membership_type = models.ForeignKey(
'MembershipType',
null=True, blank=True,
related_name='granted_by',
on_delete=models.PROTECT,
verbose_name=_('This product creates a membership of type'),
)
grant_membership_duration_like_event = models.BooleanField(
verbose_name=_('The duration of the membership is the same as the duration of the event or event series date'),
default=True,
)
grant_membership_duration_days = models.IntegerField(
verbose_name=_('Membership duration in days'),
default=0,
)
grant_membership_duration_months = models.IntegerField(
verbose_name=_('Membership duration in months'),
default=0,
)
# !!! Attention: If you add new fields here, also add them to the copying code in
# pretix/control/forms/item.py if applicable.
@@ -760,6 +788,15 @@ class ItemVariation(models.Model):
help_text=_('If set, this will be displayed next to the current price to show that the current price is a '
'discounted one. This is just a cosmetic setting and will not actually impact pricing.')
)
require_membership = models.BooleanField(
verbose_name=_('Require a valid membership'),
default=False,
)
require_membership_types = models.ManyToManyField(
'MembershipType',
verbose_name=_('Membership types'),
blank=True,
)
objects = ScopedManager(organizer='item__event__organizer')