black everything, working on #355
This commit is contained in:
parent
20f380dfd6
commit
377a77143c
|
@ -7,11 +7,10 @@ app_name = "backoffice"
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", BackofficeIndexView.as_view(), name="index"),
|
path("", BackofficeIndexView.as_view(), name="index"),
|
||||||
# infodesk
|
# infodesk
|
||||||
path("infodesk/", include(
|
path(
|
||||||
[
|
"infodesk/",
|
||||||
path("", ScanTicketsView.as_view(), name="scan_tickets"),
|
include([path("", ScanTicketsView.as_view(), name="scan_tickets"),]),
|
||||||
]
|
),
|
||||||
)),
|
|
||||||
path("shop_tickets/", ShopTicketOverview.as_view(), name="shop_ticket_overview"),
|
path("shop_tickets/", ShopTicketOverview.as_view(), name="shop_ticket_overview"),
|
||||||
path("product_handout/", ProductHandoutView.as_view(), name="product_handout"),
|
path("product_handout/", ProductHandoutView.as_view(), name="product_handout"),
|
||||||
path("badge_handout/", BadgeHandoutView.as_view(), name="badge_handout"),
|
path("badge_handout/", BadgeHandoutView.as_view(), name="badge_handout"),
|
||||||
|
|
|
@ -564,7 +564,9 @@ def _ticket_getter_by_pk(pk):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ScanTicketsView(LoginRequiredMixin, InfoTeamPermissionMixin, CampViewMixin,TemplateView):
|
class ScanTicketsView(
|
||||||
|
LoginRequiredMixin, InfoTeamPermissionMixin, CampViewMixin, TemplateView
|
||||||
|
):
|
||||||
template_name = "info_desk/scan.html"
|
template_name = "info_desk/scan.html"
|
||||||
|
|
||||||
ticket = None
|
ticket = None
|
||||||
|
@ -591,23 +593,23 @@ class ScanTicketsView(LoginRequiredMixin, InfoTeamPermissionMixin, CampViewMixin
|
||||||
messages.warning(self.request, "Ticket not found!")
|
messages.warning(self.request, "Ticket not found!")
|
||||||
|
|
||||||
elif self.order_search:
|
elif self.order_search:
|
||||||
context['order'] = self.order
|
context["order"] = self.order
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def post(self, request, **kwargs):
|
def post(self, request, **kwargs):
|
||||||
if 'check_in_ticket_id' in request.POST:
|
if "check_in_ticket_id" in request.POST:
|
||||||
self.ticket = self.check_in_ticket(request)
|
self.ticket = self.check_in_ticket(request)
|
||||||
elif 'badge_ticket_id' in request.POST:
|
elif "badge_ticket_id" in request.POST:
|
||||||
self.ticket = self.hand_out_badge(request)
|
self.ticket = self.hand_out_badge(request)
|
||||||
elif 'find_order_id' in request.POST:
|
elif "find_order_id" in request.POST:
|
||||||
self.order_search = True
|
self.order_search = True
|
||||||
try:
|
try:
|
||||||
order_id = self.request.POST.get('find_order_id')
|
order_id = self.request.POST.get("find_order_id")
|
||||||
self.order = Order.objects.get(id=order_id)
|
self.order = Order.objects.get(id=order_id)
|
||||||
except Order.DoesNotExist:
|
except Order.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
elif 'mark_as_paid' in request.POST:
|
elif "mark_as_paid" in request.POST:
|
||||||
self.mark_order_as_paid(request)
|
self.mark_order_as_paid(request)
|
||||||
|
|
||||||
return super().get(request, **kwargs)
|
return super().get(request, **kwargs)
|
||||||
|
@ -621,7 +623,7 @@ class ScanTicketsView(LoginRequiredMixin, InfoTeamPermissionMixin, CampViewMixin
|
||||||
return ticket_to_check_in
|
return ticket_to_check_in
|
||||||
|
|
||||||
def hand_out_badge(self, request):
|
def hand_out_badge(self, request):
|
||||||
badge_ticket_id = request.POST.get('badge_ticket_id')
|
badge_ticket_id = request.POST.get("badge_ticket_id")
|
||||||
ticket_to_handout_badge_for = _ticket_getter_by_pk(badge_ticket_id)
|
ticket_to_handout_badge_for = _ticket_getter_by_pk(badge_ticket_id)
|
||||||
ticket_to_handout_badge_for.badge_handed_out = True
|
ticket_to_handout_badge_for.badge_handed_out = True
|
||||||
ticket_to_handout_badge_for.save()
|
ticket_to_handout_badge_for.save()
|
||||||
|
@ -629,7 +631,7 @@ class ScanTicketsView(LoginRequiredMixin, InfoTeamPermissionMixin, CampViewMixin
|
||||||
return ticket_to_handout_badge_for
|
return ticket_to_handout_badge_for
|
||||||
|
|
||||||
def mark_order_as_paid(self, request):
|
def mark_order_as_paid(self, request):
|
||||||
order = Order.objects.get(id=request.POST.get('mark_as_paid'))
|
order = Order.objects.get(id=request.POST.get("mark_as_paid"))
|
||||||
order.mark_as_paid()
|
order.mark_as_paid()
|
||||||
messages.success(request, "Order #{} has been marked as paid!".format(order.id))
|
messages.success(request, "Order #{} has been marked as paid!".format(order.id))
|
||||||
|
|
||||||
|
@ -643,6 +645,5 @@ class ShopTicketOverview(LoginRequiredMixin, CampViewMixin, ListView):
|
||||||
context_object_name = "shop_tickets"
|
context_object_name = "shop_tickets"
|
||||||
|
|
||||||
def get_context_data(self, *, object_list=None, **kwargs):
|
def get_context_data(self, *, object_list=None, **kwargs):
|
||||||
kwargs['ticket_types'] = TicketType.objects.filter(camp=self.camp)
|
kwargs["ticket_types"] = TicketType.objects.filter(camp=self.camp)
|
||||||
return super().get_context_data(object_list=object_list, **kwargs)
|
return super().get_context_data(object_list=object_list, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,14 @@ class CampFactory(DjangoModelFactory):
|
||||||
buildup = factory.LazyFunction(
|
buildup = factory.LazyFunction(
|
||||||
lambda: DateTimeTZRange(
|
lambda: DateTimeTZRange(
|
||||||
lower=timezone.now() - timezone.timedelta(days=3),
|
lower=timezone.now() - timezone.timedelta(days=3),
|
||||||
upper=timezone.now() - timezone.timedelta(hours=1)
|
upper=timezone.now() - timezone.timedelta(hours=1),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
camp = factory.LazyFunction(
|
camp = factory.LazyFunction(
|
||||||
lambda: DateTimeTZRange(lower=timezone.now(), upper=timezone.now() + timezone.timedelta(days=8))
|
lambda: DateTimeTZRange(
|
||||||
|
lower=timezone.now(), upper=timezone.now() + timezone.timedelta(days=8)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
teardown = factory.LazyFunction(
|
teardown = factory.LazyFunction(
|
||||||
|
|
|
@ -6,13 +6,15 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('camps', '0032_auto_20180917_1754'),
|
("camps", "0032_auto_20180917_1754"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='camp',
|
model_name="camp",
|
||||||
name='show_schedule',
|
name="show_schedule",
|
||||||
field=models.BooleanField(default=True, help_text='Check if the schedule should be shown.'),
|
field=models.BooleanField(
|
||||||
|
default=True, help_text="Check if the schedule should be shown."
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -24,6 +24,7 @@ def add_new_speakerproposal_email(speakerproposal):
|
||||||
subject="New speaker proposal '%s' was just submitted" % speakerproposal.name,
|
subject="New speaker proposal '%s' was just submitted" % speakerproposal.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_new_eventproposal_email(eventproposal):
|
def add_new_eventproposal_email(eventproposal):
|
||||||
formatdict = {"proposal": eventproposal}
|
formatdict = {"proposal": eventproposal}
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ def add_new_eventproposal_email(eventproposal):
|
||||||
subject="New event proposal '%s' was just submitted" % eventproposal.title,
|
subject="New event proposal '%s' was just submitted" % eventproposal.title,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_speakerproposal_updated_email(speakerproposal):
|
def add_speakerproposal_updated_email(speakerproposal):
|
||||||
formatdict = {"proposal": speakerproposal}
|
formatdict = {"proposal": speakerproposal}
|
||||||
|
|
||||||
|
@ -58,6 +60,7 @@ def add_speakerproposal_updated_email(speakerproposal):
|
||||||
subject="Speaker proposal '%s' was just updated" % speakerproposal.name,
|
subject="Speaker proposal '%s' was just updated" % speakerproposal.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_eventproposal_updated_email(eventproposal):
|
def add_eventproposal_updated_email(eventproposal):
|
||||||
formatdict = {"proposal": eventproposal}
|
formatdict = {"proposal": eventproposal}
|
||||||
|
|
||||||
|
@ -74,4 +77,3 @@ def add_eventproposal_updated_email(eventproposal):
|
||||||
formatdict=formatdict,
|
formatdict=formatdict,
|
||||||
subject="Event proposal '%s' was just updated" % eventproposal.title,
|
subject="Event proposal '%s' was just updated" % eventproposal.title,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,16 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('program', '0071_auto_20180827_1958'),
|
("program", "0071_auto_20180827_1958"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='speakerproposal',
|
model_name="speakerproposal",
|
||||||
name='email',
|
name="email",
|
||||||
field=models.EmailField(help_text='The email of the speaker (defaults to the logged in user if empty).', max_length=150),
|
field=models.EmailField(
|
||||||
|
help_text="The email of the speaker (defaults to the logged in user if empty).",
|
||||||
|
max_length=150,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,16 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('program', '0072_auto_20190616_1746'),
|
("program", "0072_auto_20190616_1746"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='eventproposal',
|
model_name="eventproposal",
|
||||||
name='use_provided_speaker_laptop',
|
name="use_provided_speaker_laptop",
|
||||||
field=models.BooleanField(default=False, help_text='Will you be using the provided speaker laptop?'),
|
field=models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="Will you be using the provided speaker laptop?",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,15 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('program', '0073_eventproposal_use_provided_speaker_laptop'),
|
("program", "0073_eventproposal_use_provided_speaker_laptop"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='eventproposal',
|
model_name="eventproposal",
|
||||||
name='use_provided_speaker_laptop',
|
name="use_provided_speaker_laptop",
|
||||||
field=models.BooleanField(default=True, help_text='Will you be using the provided speaker laptop?'),
|
field=models.BooleanField(
|
||||||
|
default=True, help_text="Will you be using the provided speaker laptop?"
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -43,17 +43,17 @@ class MultiForm(object):
|
||||||
button. MultiForm imitates the Form API so that it is invisible to anybody
|
button. MultiForm imitates the Form API so that it is invisible to anybody
|
||||||
else that you are using a MultiForm.
|
else that you are using a MultiForm.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
form_classes = {}
|
form_classes = {}
|
||||||
|
|
||||||
def __init__(self, data=None, files=None, *args, **kwargs):
|
def __init__(self, data=None, files=None, *args, **kwargs):
|
||||||
# Some things, such as the WizardView expect these to exist.
|
# Some things, such as the WizardView expect these to exist.
|
||||||
self.data, self.files = data, files
|
self.data, self.files = data, files
|
||||||
kwargs.update(
|
kwargs.update(
|
||||||
data=data,
|
data=data, files=files,
|
||||||
files=files,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.initials = kwargs.pop('initial', None)
|
self.initials = kwargs.pop("initial", None)
|
||||||
if self.initials is None:
|
if self.initials is None:
|
||||||
self.initials = {}
|
self.initials = {}
|
||||||
self.forms = OrderedDict()
|
self.forms = OrderedDict()
|
||||||
|
@ -68,14 +68,13 @@ class MultiForm(object):
|
||||||
Returns the args and kwargs for initializing one of our form children.
|
Returns the args and kwargs for initializing one of our form children.
|
||||||
"""
|
"""
|
||||||
fkwargs = kwargs.copy()
|
fkwargs = kwargs.copy()
|
||||||
prefix = kwargs.get('prefix')
|
prefix = kwargs.get("prefix")
|
||||||
if prefix is None:
|
if prefix is None:
|
||||||
prefix = key
|
prefix = key
|
||||||
else:
|
else:
|
||||||
prefix = '{0}__{1}'.format(key, prefix)
|
prefix = "{0}__{1}".format(key, prefix)
|
||||||
fkwargs.update(
|
fkwargs.update(
|
||||||
initial=self.initials.get(key),
|
initial=self.initials.get(key), prefix=prefix,
|
||||||
prefix=prefix,
|
|
||||||
)
|
)
|
||||||
return args, fkwargs
|
return args, fkwargs
|
||||||
|
|
||||||
|
@ -134,19 +133,20 @@ class MultiForm(object):
|
||||||
|
|
||||||
def non_field_errors(self):
|
def non_field_errors(self):
|
||||||
form_errors = (
|
form_errors = (
|
||||||
form.non_field_errors() for form in self.forms.values()
|
form.non_field_errors()
|
||||||
if hasattr(form, 'non_field_errors')
|
for form in self.forms.values()
|
||||||
|
if hasattr(form, "non_field_errors")
|
||||||
)
|
)
|
||||||
return ErrorList(chain(self.crossform_errors, *form_errors))
|
return ErrorList(chain(self.crossform_errors, *form_errors))
|
||||||
|
|
||||||
def as_table(self):
|
def as_table(self):
|
||||||
return mark_safe(''.join(form.as_table() for form in self.forms.values()))
|
return mark_safe("".join(form.as_table() for form in self.forms.values()))
|
||||||
|
|
||||||
def as_ul(self):
|
def as_ul(self):
|
||||||
return mark_safe(''.join(form.as_ul() for form in self.forms.values()))
|
return mark_safe("".join(form.as_ul() for form in self.forms.values()))
|
||||||
|
|
||||||
def as_p(self):
|
def as_p(self):
|
||||||
return mark_safe(''.join(form.as_p() for form in self.forms.values()))
|
return mark_safe("".join(form.as_p() for form in self.forms.values()))
|
||||||
|
|
||||||
def is_multipart(self):
|
def is_multipart(self):
|
||||||
return any(form.is_multipart() for form in self.forms.values())
|
return any(form.is_multipart() for form in self.forms.values())
|
||||||
|
@ -167,14 +167,15 @@ class MultiForm(object):
|
||||||
def cleaned_data(self):
|
def cleaned_data(self):
|
||||||
return OrderedDict(
|
return OrderedDict(
|
||||||
(key, form.cleaned_data)
|
(key, form.cleaned_data)
|
||||||
for key, form in self.forms.items() if form.is_valid()
|
for key, form in self.forms.items()
|
||||||
|
if form.is_valid()
|
||||||
)
|
)
|
||||||
|
|
||||||
@cleaned_data.setter
|
@cleaned_data.setter
|
||||||
def cleaned_data(self, data):
|
def cleaned_data(self, data):
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
child_form = self[key]
|
child_form = self[key]
|
||||||
if hasattr(child_form, 'forms'):
|
if hasattr(child_form, "forms"):
|
||||||
for formlet, formlet_data in zip(child_form.forms, value):
|
for formlet, formlet_data in zip(child_form.forms, value):
|
||||||
formlet.cleaned_data = formlet_data
|
formlet.cleaned_data = formlet_data
|
||||||
else:
|
else:
|
||||||
|
@ -187,33 +188,37 @@ class MultiModelForm(MultiForm):
|
||||||
means that it includes support for the instance parameter in initialization
|
means that it includes support for the instance parameter in initialization
|
||||||
and adds a save method.
|
and adds a save method.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.instances = kwargs.pop('instance', None)
|
self.instances = kwargs.pop("instance", None)
|
||||||
if self.instances is None:
|
if self.instances is None:
|
||||||
self.instances = {}
|
self.instances = {}
|
||||||
super(MultiModelForm, self).__init__(*args, **kwargs)
|
super(MultiModelForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def get_form_args_kwargs(self, key, args, kwargs):
|
def get_form_args_kwargs(self, key, args, kwargs):
|
||||||
fargs, fkwargs = super(MultiModelForm, self).get_form_args_kwargs(key, args, kwargs)
|
fargs, fkwargs = super(MultiModelForm, self).get_form_args_kwargs(
|
||||||
|
key, args, kwargs
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
# If we only pass instance when there was one specified, we make it
|
# If we only pass instance when there was one specified, we make it
|
||||||
# possible to use non-ModelForms together with ModelForms.
|
# possible to use non-ModelForms together with ModelForms.
|
||||||
fkwargs['instance'] = self.instances[key]
|
fkwargs["instance"] = self.instances[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
return fargs, fkwargs
|
return fargs, fkwargs
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
objects = OrderedDict(
|
objects = OrderedDict(
|
||||||
(key, form.save(commit))
|
(key, form.save(commit)) for key, form in self.forms.items()
|
||||||
for key, form in self.forms.items()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if any(hasattr(form, 'save_m2m') for form in self.forms.values()):
|
if any(hasattr(form, "save_m2m") for form in self.forms.values()):
|
||||||
|
|
||||||
def save_m2m():
|
def save_m2m():
|
||||||
for form in self.forms.values():
|
for form in self.forms.values():
|
||||||
if hasattr(form, 'save_m2m'):
|
if hasattr(form, "save_m2m"):
|
||||||
form.save_m2m()
|
form.save_m2m()
|
||||||
|
|
||||||
self.save_m2m = save_m2m
|
self.save_m2m = save_m2m
|
||||||
|
|
||||||
return objects
|
return objects
|
||||||
|
|
|
@ -6,13 +6,16 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('rideshare', '0002_auto_20180814_1942'),
|
("rideshare", "0002_auto_20180814_1942"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='has_car',
|
name="has_car",
|
||||||
field=models.BooleanField(default=True, help_text='Leave checked if you are offering a ride, uncheck if you need a ride'),
|
field=models.BooleanField(
|
||||||
|
default=True,
|
||||||
|
help_text="Leave checked if you are offering a ride, uncheck if you need a ride",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,11 @@ from django.db import migrations
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('rideshare', '0003_ride_has_car'),
|
("rideshare", "0003_ride_has_car"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name='ride',
|
model_name="ride", old_name="location", new_name="from_location",
|
||||||
old_name='location',
|
|
||||||
new_name='from_location',
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,14 +6,14 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('rideshare', '0004_auto_20190711_2036'),
|
("rideshare", "0004_auto_20190711_2036"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='to_location',
|
name="to_location",
|
||||||
field=models.CharField(default='BornHack', max_length=100),
|
field=models.CharField(default="BornHack", max_length=100),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,38 +6,51 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('rideshare', '0005_ride_to_location'),
|
("rideshare", "0005_ride_to_location"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='description',
|
name="description",
|
||||||
field=models.TextField(help_text='Include any details you want, like luggage space/requirements, contact info and so on.'),
|
field=models.TextField(
|
||||||
|
help_text="Include any details you want, like luggage space/requirements, contact info and so on."
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='from_location',
|
name="from_location",
|
||||||
field=models.CharField(help_text='Where does this ride begin?', max_length=100),
|
field=models.CharField(
|
||||||
|
help_text="Where does this ride begin?", max_length=100
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='has_car',
|
name="has_car",
|
||||||
field=models.BooleanField(default=True, help_text='Leave checked if you are offering a ride, uncheck if you need a ride.'),
|
field=models.BooleanField(
|
||||||
|
default=True,
|
||||||
|
help_text="Leave checked if you are offering a ride, uncheck if you need a ride.",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='seats',
|
name="seats",
|
||||||
field=models.PositiveIntegerField(help_text='How many seats are you offering/how many seats do you need?'),
|
field=models.PositiveIntegerField(
|
||||||
|
help_text="How many seats are you offering/how many seats do you need?"
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='to_location',
|
name="to_location",
|
||||||
field=models.CharField(help_text='What is the destination of this ride?', max_length=100),
|
field=models.CharField(
|
||||||
|
help_text="What is the destination of this ride?", max_length=100
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='when',
|
name="when",
|
||||||
field=models.DateTimeField(help_text='When does this ride leave? Format is YYYY-MM-DD HH:mm'),
|
field=models.DateTimeField(
|
||||||
|
help_text="When does this ride leave? Format is YYYY-MM-DD HH:mm"
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,17 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('rideshare', '0006_auto_20190713_0859'),
|
("rideshare", "0006_auto_20190713_0859"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='author',
|
name="author",
|
||||||
field=models.CharField(default='Unnamed', help_text='Let people know who posted this', max_length=100),
|
field=models.CharField(
|
||||||
|
default="Unnamed",
|
||||||
|
help_text="Let people know who posted this",
|
||||||
|
max_length=100,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,17 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('rideshare', '0007_ride_author'),
|
("rideshare", "0007_ride_author"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='ride',
|
model_name="ride",
|
||||||
name='author',
|
name="author",
|
||||||
field=models.CharField(default='Anonymous', help_text='Let people know who posted this', max_length=100),
|
field=models.CharField(
|
||||||
|
default="Anonymous",
|
||||||
|
help_text="Let people know who posted this",
|
||||||
|
max_length=100,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -7,16 +7,28 @@ from utils.models import UUIDModel, CampRelatedModel
|
||||||
class Ride(UUIDModel, CampRelatedModel):
|
class Ride(UUIDModel, CampRelatedModel):
|
||||||
camp = models.ForeignKey("camps.Camp", on_delete=models.PROTECT)
|
camp = models.ForeignKey("camps.Camp", on_delete=models.PROTECT)
|
||||||
user = models.ForeignKey("auth.User", on_delete=models.PROTECT)
|
user = models.ForeignKey("auth.User", on_delete=models.PROTECT)
|
||||||
author = models.CharField(max_length=100, help_text="Let people know who posted this", default="Anonymous")
|
author = models.CharField(
|
||||||
|
max_length=100, help_text="Let people know who posted this", default="Anonymous"
|
||||||
|
)
|
||||||
has_car = models.BooleanField(
|
has_car = models.BooleanField(
|
||||||
default=True,
|
default=True,
|
||||||
help_text="Leave checked if you are offering a ride, uncheck if you need a ride."
|
help_text="Leave checked if you are offering a ride, uncheck if you need a ride.",
|
||||||
|
)
|
||||||
|
seats = models.PositiveIntegerField(
|
||||||
|
help_text="How many seats are you offering/how many seats do you need?"
|
||||||
|
)
|
||||||
|
from_location = models.CharField(
|
||||||
|
max_length=100, help_text="Where does this ride begin?"
|
||||||
|
)
|
||||||
|
to_location = models.CharField(
|
||||||
|
max_length=100, help_text="What is the destination of this ride?"
|
||||||
|
)
|
||||||
|
when = models.DateTimeField(
|
||||||
|
help_text="When does this ride leave? Format is YYYY-MM-DD HH:mm"
|
||||||
|
)
|
||||||
|
description = models.TextField(
|
||||||
|
help_text="Include any details you want, like luggage space/requirements, contact info and so on."
|
||||||
)
|
)
|
||||||
seats = models.PositiveIntegerField(help_text="How many seats are you offering/how many seats do you need?")
|
|
||||||
from_location = models.CharField(max_length=100, help_text="Where does this ride begin?")
|
|
||||||
to_location = models.CharField(max_length=100, help_text="What is the destination of this ride?")
|
|
||||||
when = models.DateTimeField(help_text="When does this ride leave? Format is YYYY-MM-DD HH:mm")
|
|
||||||
description = models.TextField(help_text="Include any details you want, like luggage space/requirements, contact info and so on.")
|
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse(
|
return reverse(
|
||||||
|
|
|
@ -63,15 +63,21 @@ class RideDetail(LoginRequiredMixin, CampViewMixin, DetailView):
|
||||||
|
|
||||||
class RideCreate(LoginRequiredMixin, CampViewMixin, CreateView):
|
class RideCreate(LoginRequiredMixin, CampViewMixin, CreateView):
|
||||||
model = Ride
|
model = Ride
|
||||||
fields = ["author", "has_car", "from_location", "to_location", "when", "seats", "description"]
|
fields = [
|
||||||
|
"author",
|
||||||
|
"has_car",
|
||||||
|
"from_location",
|
||||||
|
"to_location",
|
||||||
|
"when",
|
||||||
|
"seats",
|
||||||
|
"description",
|
||||||
|
]
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
"""
|
"""
|
||||||
Default 'author' to users public_credit_name where relevant
|
Default 'author' to users public_credit_name where relevant
|
||||||
"""
|
"""
|
||||||
return {
|
return {"author": self.request.user.profile.get_public_credit_name}
|
||||||
"author": self.request.user.profile.get_public_credit_name
|
|
||||||
}
|
|
||||||
|
|
||||||
def form_valid(self, form, **kwargs):
|
def form_valid(self, form, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -92,7 +98,15 @@ class IsRideOwnerMixin(UserPassesTestMixin):
|
||||||
|
|
||||||
class RideUpdate(LoginRequiredMixin, CampViewMixin, IsRideOwnerMixin, UpdateView):
|
class RideUpdate(LoginRequiredMixin, CampViewMixin, IsRideOwnerMixin, UpdateView):
|
||||||
model = Ride
|
model = Ride
|
||||||
fields = ["author", "has_car", "from_location", "to_location", "when", "seats", "description"]
|
fields = [
|
||||||
|
"author",
|
||||||
|
"has_car",
|
||||||
|
"from_location",
|
||||||
|
"to_location",
|
||||||
|
"when",
|
||||||
|
"seats",
|
||||||
|
"description",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class RideDelete(LoginRequiredMixin, CampViewMixin, IsRideOwnerMixin, DeleteView):
|
class RideDelete(LoginRequiredMixin, CampViewMixin, IsRideOwnerMixin, DeleteView):
|
||||||
|
|
|
@ -19,7 +19,9 @@ def do_work():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# check if we need to generate any proforma invoices for shop orders
|
# check if we need to generate any proforma invoices for shop orders
|
||||||
for order in Order.objects.filter(Q(pdf="") | Q(pdf__isnull=True), open__isnull=True):
|
for order in Order.objects.filter(
|
||||||
|
Q(pdf="") | Q(pdf__isnull=True), open__isnull=True
|
||||||
|
):
|
||||||
# generate proforma invoice for this Order
|
# generate proforma invoice for this Order
|
||||||
pdffile = generate_pdf_letter(
|
pdffile = generate_pdf_letter(
|
||||||
filename=order.filename,
|
filename=order.filename,
|
||||||
|
@ -141,4 +143,3 @@ def do_work():
|
||||||
"Unable to add creditnote email for creditnote %s to %s"
|
"Unable to add creditnote email for creditnote %s to %s"
|
||||||
% (creditnote.pk, creditnote.user.email)
|
% (creditnote.pk, creditnote.user.email)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,15 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('shop', '0057_order_notes'),
|
("shop", "0057_order_notes"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='order',
|
model_name="order",
|
||||||
name='pdf',
|
name="pdf",
|
||||||
field=models.FileField(blank=True, null=True, upload_to='proforma_invoices/'),
|
field=models.FileField(
|
||||||
|
blank=True, null=True, upload_to="proforma_invoices/"
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,13 @@ from django.db import migrations
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('shop', '0058_order_pdf'),
|
("shop", "0058_order_pdf"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name='orderproductrelation',
|
model_name="orderproductrelation",
|
||||||
old_name='handed_out',
|
old_name="handed_out",
|
||||||
new_name='ticket_generated',
|
new_name="ticket_generated",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,16 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('shop', '0059_auto_20190718_2051'),
|
("shop", "0059_auto_20190718_2051"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='productcategory',
|
model_name="productcategory",
|
||||||
name='weight',
|
name="weight",
|
||||||
field=models.IntegerField(default=100, help_text='Sorting weight. Heavier items sink to the bottom.'),
|
field=models.IntegerField(
|
||||||
|
default=100,
|
||||||
|
help_text="Sorting weight. Heavier items sink to the bottom.",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -376,7 +376,9 @@ class ProductCategory(CreatedUpdatedModel, UUIDModel):
|
||||||
name = models.CharField(max_length=150)
|
name = models.CharField(max_length=150)
|
||||||
slug = models.SlugField()
|
slug = models.SlugField()
|
||||||
public = models.BooleanField(default=True)
|
public = models.BooleanField(default=True)
|
||||||
weight = models.IntegerField(default=100, help_text="Sorting weight. Heavier items sink to the bottom.")
|
weight = models.IntegerField(
|
||||||
|
default=100, help_text="Sorting weight. Heavier items sink to the bottom."
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
|
@ -156,7 +156,9 @@ class ShopIndexView(ListView):
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = super(ShopIndexView, self).get_queryset()
|
queryset = super(ShopIndexView, self).get_queryset()
|
||||||
return queryset.available().order_by("category__weight", "category__name", "price", "name")
|
return queryset.available().order_by(
|
||||||
|
"category__weight", "category__name", "price", "name"
|
||||||
|
)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(ShopIndexView, self).get_context_data(**kwargs)
|
context = super(ShopIndexView, self).get_context_data(**kwargs)
|
||||||
|
|
|
@ -5,7 +5,14 @@ from .models import Sponsor, SponsorTier
|
||||||
|
|
||||||
@admin.register(Sponsor)
|
@admin.register(Sponsor)
|
||||||
class SponsorAdmin(admin.ModelAdmin):
|
class SponsorAdmin(admin.ModelAdmin):
|
||||||
list_display = ("name", "tier", "ticket_email", "ticket_ready", "tickets_sent", "tickets_generated")
|
list_display = (
|
||||||
|
"name",
|
||||||
|
"tier",
|
||||||
|
"ticket_email",
|
||||||
|
"ticket_ready",
|
||||||
|
"tickets_sent",
|
||||||
|
"tickets_generated",
|
||||||
|
)
|
||||||
list_filter = ("tier__camp",)
|
list_filter = ("tier__camp",)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from utils.email import add_outgoing_email
|
||||||
|
|
||||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||||
|
|
||||||
|
|
||||||
def add_sponsorticket_email(ticket):
|
def add_sponsorticket_email(ticket):
|
||||||
# put formatdict together
|
# put formatdict together
|
||||||
formatdict = {
|
formatdict = {
|
||||||
|
@ -31,4 +32,3 @@ def add_sponsorticket_email(ticket):
|
||||||
attachment=f.read(),
|
attachment=f.read(),
|
||||||
attachment_filename=filename,
|
attachment_filename=filename,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -29,20 +29,25 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
for sponsor in sponsors:
|
for sponsor in sponsors:
|
||||||
if (
|
if (
|
||||||
sponsor.tier.tickets and
|
sponsor.tier.tickets
|
||||||
sponsor.tickets_generated and
|
and sponsor.tickets_generated
|
||||||
sponsor.ticket_email and
|
and sponsor.ticket_email
|
||||||
sponsor.ticket_ready and
|
and sponsor.ticket_ready
|
||||||
not sponsor.tickets_sent
|
and not sponsor.tickets_sent
|
||||||
):
|
):
|
||||||
self.output("# Generating outgoing emails to send tickets for {}:".format(sponsor))
|
self.output(
|
||||||
|
"# Generating outgoing emails to send tickets for {}:".format(
|
||||||
|
sponsor
|
||||||
|
)
|
||||||
|
)
|
||||||
for ticket in sponsor.sponsorticket_set.all():
|
for ticket in sponsor.sponsorticket_set.all():
|
||||||
# send the email
|
# send the email
|
||||||
if add_sponsorticket_email(ticket=ticket):
|
if add_sponsorticket_email(ticket=ticket):
|
||||||
logger.info("OK: email to %s added" % sponsor)
|
logger.info("OK: email to %s added" % sponsor)
|
||||||
else:
|
else:
|
||||||
logger.error("Unable to send sponsor ticket email to %s" % sponsor)
|
logger.error(
|
||||||
|
"Unable to send sponsor ticket email to %s" % sponsor
|
||||||
|
)
|
||||||
|
|
||||||
sponsor.tickets_sent = True
|
sponsor.tickets_sent = True
|
||||||
sponsor.save()
|
sponsor.save()
|
||||||
|
|
||||||
|
|
|
@ -6,23 +6,34 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('sponsors', '0011_auto_20181118_1513'),
|
("sponsors", "0011_auto_20181118_1513"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='sponsor',
|
model_name="sponsor",
|
||||||
name='ticket_email',
|
name="ticket_email",
|
||||||
field=models.EmailField(blank=True, help_text='The email to send the tickets to', max_length=254, null=True),
|
field=models.EmailField(
|
||||||
|
blank=True,
|
||||||
|
help_text="The email to send the tickets to",
|
||||||
|
max_length=254,
|
||||||
|
null=True,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='sponsor',
|
model_name="sponsor",
|
||||||
name='ticket_ready',
|
name="ticket_ready",
|
||||||
field=models.BooleanField(default=False, help_text='Check when we are ready to send tickets to this sponsor.'),
|
field=models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="Check when we are ready to send tickets to this sponsor.",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='sponsor',
|
model_name="sponsor",
|
||||||
name='tickets_sent',
|
name="tickets_sent",
|
||||||
field=models.BooleanField(default=False, help_text='True when the tickets have been emailed to the sponsor'),
|
field=models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="True when the tickets have been emailed to the sponsor",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -23,11 +23,19 @@ class Sponsor(CampRelatedModel):
|
||||||
|
|
||||||
tickets_generated = models.BooleanField(default=False)
|
tickets_generated = models.BooleanField(default=False)
|
||||||
|
|
||||||
ticket_email = models.EmailField(null=True, blank=True, help_text="The email to send the tickets to")
|
ticket_email = models.EmailField(
|
||||||
|
null=True, blank=True, help_text="The email to send the tickets to"
|
||||||
|
)
|
||||||
|
|
||||||
ticket_ready = models.BooleanField(default=False, help_text="Check when we are ready to send tickets to this sponsor.")
|
ticket_ready = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="Check when we are ready to send tickets to this sponsor.",
|
||||||
|
)
|
||||||
|
|
||||||
tickets_sent = models.BooleanField(default=False, help_text="True when the tickets have been emailed to the sponsor")
|
tickets_sent = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="True when the tickets have been emailed to the sponsor",
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{} ({})".format(self.name, self.tier.camp)
|
return "{} ({})".format(self.name, self.tier.camp)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from .models import TicketType, SponsorTicket, DiscountTicket, ShopTicket
|
||||||
class BaseTicketAdmin(admin.ModelAdmin):
|
class BaseTicketAdmin(admin.ModelAdmin):
|
||||||
actions = ["generate_pdf"]
|
actions = ["generate_pdf"]
|
||||||
exclude = ["qrcode_base64"]
|
exclude = ["qrcode_base64"]
|
||||||
readonly_fields = ['token', 'badge_token']
|
readonly_fields = ["token", "badge_token"]
|
||||||
|
|
||||||
def generate_pdf(self, request, queryset):
|
def generate_pdf(self, request, queryset):
|
||||||
for ticket in queryset.all():
|
for ticket in queryset.all():
|
||||||
|
|
|
@ -6,23 +6,23 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('tickets', '0005_auto_20180318_0906'),
|
("tickets", "0005_auto_20180318_0906"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='discountticket',
|
model_name="discountticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(max_length=64, null=True),
|
field=models.CharField(max_length=64, null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='shopticket',
|
model_name="shopticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(max_length=64, null=True),
|
field=models.CharField(max_length=64, null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='sponsorticket',
|
model_name="sponsorticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(max_length=64, null=True),
|
field=models.CharField(max_length=64, null=True),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,38 +6,32 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('tickets', '0007_save_token_to_db'),
|
("tickets", "0007_save_token_to_db"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name='discountticket',
|
model_name="discountticket", old_name="checked_in", new_name="used",
|
||||||
old_name='checked_in',
|
|
||||||
new_name='used',
|
|
||||||
),
|
),
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name='shopticket',
|
model_name="shopticket", old_name="checked_in", new_name="used",
|
||||||
old_name='checked_in',
|
|
||||||
new_name='used',
|
|
||||||
),
|
),
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name='sponsorticket',
|
model_name="sponsorticket", old_name="checked_in", new_name="used",
|
||||||
old_name='checked_in',
|
|
||||||
new_name='used',
|
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='discountticket',
|
model_name="discountticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(max_length=64),
|
field=models.CharField(max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='shopticket',
|
model_name="shopticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(max_length=64),
|
field=models.CharField(max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='sponsorticket',
|
model_name="sponsorticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(max_length=64),
|
field=models.CharField(max_length=64),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,13 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('tickets', '0008_auto_20190718_2055'),
|
("tickets", "0008_auto_20190718_2055"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='tickettype',
|
model_name="tickettype",
|
||||||
name='includes_badge',
|
name="includes_badge",
|
||||||
field=models.BooleanField(default=False),
|
field=models.BooleanField(default=False),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,23 +6,23 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('tickets', '0009_tickettype_includes_badge'),
|
("tickets", "0009_tickettype_includes_badge"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='discountticket',
|
model_name="discountticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(max_length=64, null=True),
|
field=models.CharField(max_length=64, null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='shopticket',
|
model_name="shopticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(max_length=64, null=True),
|
field=models.CharField(max_length=64, null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='sponsorticket',
|
model_name="sponsorticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(max_length=64, null=True),
|
field=models.CharField(max_length=64, null=True),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,23 +6,23 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('tickets', '0011_save_badge_token_to_db'),
|
("tickets", "0011_save_badge_token_to_db"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='discountticket',
|
model_name="discountticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(max_length=64),
|
field=models.CharField(max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='shopticket',
|
model_name="shopticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(max_length=64),
|
field=models.CharField(max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='sponsorticket',
|
model_name="sponsorticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(max_length=64),
|
field=models.CharField(max_length=64),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,16 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('tickets', '0012_auto_20190724_2037'),
|
("tickets", "0012_auto_20190724_2037"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='tickettype',
|
model_name="tickettype",
|
||||||
name='single_ticket_per_product',
|
name="single_ticket_per_product",
|
||||||
field=models.BooleanField(default=False, help_text='Only create one ticket for a product/order pair no matter the quantity. Useful for products which are bought in larger quantity (ie. village chairs)'),
|
field=models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="Only create one ticket for a product/order pair no matter the quantity. Useful for products which are bought in larger quantity (ie. village chairs)",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,38 +6,38 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('tickets', '0013_tickettype_single_ticket_per_product'),
|
("tickets", "0013_tickettype_single_ticket_per_product"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='discountticket',
|
model_name="discountticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(blank=True, max_length=64),
|
field=models.CharField(blank=True, max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='discountticket',
|
model_name="discountticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(blank=True, max_length=64),
|
field=models.CharField(blank=True, max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='shopticket',
|
model_name="shopticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(blank=True, max_length=64),
|
field=models.CharField(blank=True, max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='shopticket',
|
model_name="shopticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(blank=True, max_length=64),
|
field=models.CharField(blank=True, max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='sponsorticket',
|
model_name="sponsorticket",
|
||||||
name='badge_token',
|
name="badge_token",
|
||||||
field=models.CharField(blank=True, max_length=64),
|
field=models.CharField(blank=True, max_length=64),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='sponsorticket',
|
model_name="sponsorticket",
|
||||||
name='token',
|
name="token",
|
||||||
field=models.CharField(blank=True, max_length=64),
|
field=models.CharField(blank=True, max_length=64),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -56,13 +56,12 @@ class BaseTicket(CampRelatedModel, UUIDModel):
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
camp_filter = 'ticket_type__camp'
|
camp_filter = "ticket_type__camp"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def camp(self):
|
def camp(self):
|
||||||
return self.ticket_type.camp
|
return self.ticket_type.camp
|
||||||
|
|
||||||
|
|
||||||
def save(self, **kwargs):
|
def save(self, **kwargs):
|
||||||
self.token = self._get_token()
|
self.token = self._get_token()
|
||||||
self.badge_token = self._get_badge_token()
|
self.badge_token = self._get_badge_token()
|
||||||
|
|
|
@ -6,20 +6,15 @@ from .models import ShopTicket
|
||||||
|
|
||||||
|
|
||||||
class TicketTests(TestCase):
|
class TicketTests(TestCase):
|
||||||
|
|
||||||
def test_correct_token_and_badge_token_are_different(self):
|
def test_correct_token_and_badge_token_are_different(self):
|
||||||
|
|
||||||
ticket_type = TicketTypeFactory()
|
ticket_type = TicketTypeFactory()
|
||||||
|
|
||||||
orp = OrderProductRelationFactory()
|
orp = OrderProductRelationFactory()
|
||||||
shop_ticket = ShopTicket.objects.create(
|
shop_ticket = ShopTicket.objects.create(
|
||||||
ticket_type=ticket_type,
|
ticket_type=ticket_type, product=orp.product, order=orp.order,
|
||||||
product=orp.product,
|
|
||||||
order=orp.order,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotEqual(shop_ticket.token, shop_ticket.badge_token)
|
self.assertNotEqual(shop_ticket.token, shop_ticket.badge_token)
|
||||||
self.assertEqual(shop_ticket.token, shop_ticket._get_token())
|
self.assertEqual(shop_ticket.token, shop_ticket._get_token())
|
||||||
self.assertEqual(shop_ticket.badge_token, shop_ticket._get_badge_token())
|
self.assertEqual(shop_ticket.badge_token, shop_ticket._get_badge_token())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,4 @@ from .models import OutgoingEmail
|
||||||
@admin.register(OutgoingEmail)
|
@admin.register(OutgoingEmail)
|
||||||
class OutgoingEmailAdmin(admin.ModelAdmin):
|
class OutgoingEmailAdmin(admin.ModelAdmin):
|
||||||
model = OutgoingEmail
|
model = OutgoingEmail
|
||||||
list_display = ['subject', 'to_recipients']
|
list_display = ["subject", "to_recipients"]
|
||||||
|
|
Loading…
Reference in a new issue