forked from CGM_Public/pretix_original
Remove redundant deleted field on Items, cleanerversion does this
for us. Also, slugs can be a SlugField
This commit is contained in:
74
src/pretix/base/migrations/0020_auto_20150319_1044.py
Normal file
74
src/pretix/base/migrations/0020_auto_20150319_1044.py
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pretixbase', '0019_auto_20150314_1247'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='item',
|
||||||
|
options={'verbose_name': 'Product', 'verbose_name_plural': 'Products'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='itemcategory',
|
||||||
|
options={'ordering': ('position', 'id'), 'verbose_name': 'Product category', 'verbose_name_plural': 'Product categories'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='itemvariation',
|
||||||
|
options={'verbose_name': 'Product variation', 'verbose_name_plural': 'Product variations'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='property',
|
||||||
|
options={'verbose_name': 'Product property', 'verbose_name_plural': 'Product properties'},
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='item',
|
||||||
|
name='deleted',
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='cartposition',
|
||||||
|
name='attendee_name',
|
||||||
|
field=models.CharField(null=True, help_text='Empty, if this product is not an admission ticket', verbose_name='Attendee name', max_length=255, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='event',
|
||||||
|
name='presale_end',
|
||||||
|
field=models.DateTimeField(null=True, help_text='No products will be sold after this date.', verbose_name='End of presale', blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='event',
|
||||||
|
name='presale_start',
|
||||||
|
field=models.DateTimeField(null=True, help_text='No products will be sold before this date.', verbose_name='Start of presale', blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='eventpermission',
|
||||||
|
name='can_change_items',
|
||||||
|
field=models.BooleanField(default=True, verbose_name='Can change product settings'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='item',
|
||||||
|
name='admission',
|
||||||
|
field=models.BooleanField(default=False, help_text='Whether or not buying this product allows a person to enter your event', verbose_name='Is an admission ticket'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='item',
|
||||||
|
name='short_description',
|
||||||
|
field=models.TextField(null=True, help_text='This is shown below the product name in lists.', verbose_name='Short description', blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='orderposition',
|
||||||
|
name='attendee_name',
|
||||||
|
field=models.CharField(null=True, help_text='Empty, if this product is not an admission ticket', verbose_name='Attendee name', max_length=255, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='organizer',
|
||||||
|
name='slug',
|
||||||
|
field=models.SlugField(verbose_name='Slug', unique=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -228,14 +228,17 @@ class User(AbstractBaseUser, PermissionsMixin):
|
|||||||
|
|
||||||
class Organizer(Versionable):
|
class Organizer(Versionable):
|
||||||
"""
|
"""
|
||||||
This model represents an entity organizing events, like a company.
|
This model represents an entity organizing events, e.g. a company, institution,
|
||||||
Any organizer has a unique slug, which is a short name (alphanumeric,
|
charity, person, …
|
||||||
all lowercase) being used in URLs.
|
|
||||||
|
:param name: The organizer's name
|
||||||
|
:param slug: A globally unique, short name for this organizer, to be used
|
||||||
|
in URLs and similar places.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
name = models.CharField(max_length=200,
|
name = models.CharField(max_length=200,
|
||||||
verbose_name=_("Name"))
|
verbose_name=_("Name"))
|
||||||
slug = models.CharField(max_length=50,
|
slug = models.SlugField(max_length=50,
|
||||||
unique=True, db_index=True,
|
unique=True, db_index=True,
|
||||||
verbose_name=_("Slug"))
|
verbose_name=_("Slug"))
|
||||||
permitted = models.ManyToManyField(User, through='OrganizerPermission',
|
permitted = models.ManyToManyField(User, through='OrganizerPermission',
|
||||||
@@ -284,34 +287,36 @@ class OrganizerPermission(Versionable):
|
|||||||
class Event(Versionable):
|
class Event(Versionable):
|
||||||
"""
|
"""
|
||||||
This model represents an event. An event is anything you can buy
|
This model represents an event. An event is anything you can buy
|
||||||
tickets for. It belongs to one orgnaizer and has a name and a slug,
|
tickets for.
|
||||||
the latter being a short, alphanumeric, all-lowercase name being
|
|
||||||
used in URLs. The slug has to be unique among the events of the same
|
|
||||||
organizer.
|
|
||||||
|
|
||||||
An event can hold several properties, such as a default locale and
|
:param organizer: The organizer this event belongs to
|
||||||
currency.
|
:param name: This events full title
|
||||||
|
:param slug: A short, alphanumeric, all-lowercase name for use in URLs. The slug has to
|
||||||
The event has date_from and date_to field which mark the actual
|
be unique among the events of the same organizer.
|
||||||
datetime of the event itself. The show_date_to and show_times
|
:param locale: This events default locale
|
||||||
fields are used to control the display of these dates. (Without
|
:param timezone: The timezone this event takes place in (or is being described in)
|
||||||
show_times only days are shown, now times.)
|
:param currency: The currency of all prices and payments of this event
|
||||||
|
:param date_from: The datetime this event starts
|
||||||
The presale_start and presale_end fields mark the time frame in
|
:param date_to: The datetime this event ends
|
||||||
which tickets are sold for this event. These two dates override
|
:param show_date_to: If ``False``, the ``date_to`` value will not be shown to the
|
||||||
every other restrictions to ticket sale if set.
|
user and the event will be listed only with it's start date.
|
||||||
|
:param show_times: If ``False``, ``date_from`` and ``date_to`` will only be displayed
|
||||||
The payment_term_days field holds the number of days after
|
as dates, without a time of day.
|
||||||
submitting a ticket order, in which the ticket has to be paid.
|
:param presale_start: No tickets will be sold before this date.
|
||||||
The payment_term_last is the day all orders must be paid by, no
|
:param presale_end: No tickets will be sold before this date.
|
||||||
matter when they were ordered (and thus, ignoring payment_term_days).
|
:param payment_term_days: The number of days in which an order has to be
|
||||||
|
paid after it has been submitted.
|
||||||
|
:param payment_term_last: The day all orders must be paid by, no matter when
|
||||||
|
the order was placed.
|
||||||
|
:param plugins: A comma-separated list of plugin names that are active for this
|
||||||
|
event.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
organizer = VersionedForeignKey(Organizer, related_name="events",
|
organizer = VersionedForeignKey(Organizer, related_name="events",
|
||||||
on_delete=models.PROTECT)
|
on_delete=models.PROTECT)
|
||||||
name = models.CharField(max_length=200,
|
name = models.CharField(max_length=200,
|
||||||
verbose_name=_("Name"))
|
verbose_name=_("Name"))
|
||||||
slug = models.CharField(
|
slug = models.SlugField(
|
||||||
max_length=50, db_index=True,
|
max_length=50, db_index=True,
|
||||||
help_text=_(
|
help_text=_(
|
||||||
"Should be short, only contain lowercase letters and numbers, and must be unique among your events. "
|
"Should be short, only contain lowercase letters and numbers, and must be unique among your events. "
|
||||||
@@ -655,7 +660,6 @@ class Item(Versionable):
|
|||||||
default=True,
|
default=True,
|
||||||
verbose_name=_("Active"),
|
verbose_name=_("Active"),
|
||||||
)
|
)
|
||||||
deleted = models.BooleanField(default=False)
|
|
||||||
short_description = models.TextField(
|
short_description = models.TextField(
|
||||||
verbose_name=_("Short description"),
|
verbose_name=_("Short description"),
|
||||||
help_text=_("This is shown below the product name in lists."),
|
help_text=_("This is shown below the product name in lists."),
|
||||||
@@ -718,9 +722,7 @@ class Item(Versionable):
|
|||||||
self.event.get_cache().clear()
|
self.event.get_cache().clear()
|
||||||
|
|
||||||
def delete(self, *args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
self.deleted = True
|
super().delete(*args, **kwargs)
|
||||||
self.active = False
|
|
||||||
super().save()
|
|
||||||
if self.event:
|
if self.event:
|
||||||
self.event.get_cache().clear()
|
self.event.get_cache().clear()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user