|
1
|
|
|
from django import forms |
|
2
|
|
|
from django.core.urlresolvers import reverse_lazy |
|
3
|
|
|
from django.utils.safestring import mark_safe |
|
4
|
|
|
from django.utils.translation import ugettext as _ |
|
5
|
|
|
|
|
6
|
|
|
from shoop.front.checkout.addresses import AddressesPhase, AddressForm |
|
7
|
|
|
from shoop.front.checkout.confirm import ConfirmPhase, ConfirmForm |
|
8
|
|
|
from shoop.front.views.checkout import DefaultCheckoutView |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
class ReservationsCheckoutView(DefaultCheckoutView): |
|
12
|
|
|
phase_specs = [ |
|
13
|
|
|
"reservations.checkout:ReservationsAddressesPhase", |
|
14
|
|
|
"reservations.checkout:ReservationsConfirmPhase", |
|
15
|
|
|
] |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
class ReservationsConfirmForm(ConfirmForm): |
|
19
|
|
|
accept_terms = forms.BooleanField(required=True) |
|
20
|
|
|
|
|
21
|
|
|
def __init__(self, **kwargs): |
|
22
|
|
|
super(ReservationsConfirmForm, self).__init__(**kwargs) |
|
23
|
|
|
terms_and_conditions = reverse_lazy("shoop:cms_page", kwargs={"url": "terms"}) |
|
24
|
|
|
self.fields["accept_terms"].label = mark_safe(_("I have read and agree with the " |
|
|
|
|
|
|
25
|
|
|
"<a href='%s' target='_blank'>Terms and Conditions</a>")) % (terms_and_conditions) |
|
26
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
class ReservationsConfirmPhase(ConfirmPhase): |
|
29
|
|
|
form_class = ReservationsConfirmForm |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
class ReservationsAddressForm(AddressForm): |
|
33
|
|
|
def __init__(self, **kwargs): |
|
34
|
|
|
super(ReservationsAddressForm, self).__init__(**kwargs) |
|
35
|
|
|
self.fields["phone"].required = True |
|
|
|
|
|
|
36
|
|
|
self.fields["email"].required = True |
|
|
|
|
|
|
37
|
|
|
self.fields["street"].required = False |
|
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
class ReservationsAddressesPhase(AddressesPhase): |
|
41
|
|
|
address_form_class = ReservationsAddressForm |
|
42
|
|
|
|
This check looks for calls to members that are non-existent. These calls will fail.
The member could have been renamed or removed.