From 80095ed1aa7367c4770ce132f1c98daca03b5046 Mon Sep 17 00:00:00 2001 From: Levi Date: Mon, 19 Sep 2016 19:20:57 -0500 Subject: [PATCH 1/3] #hotfix Fixed select date picker --- digitalglarus/forms.py | 25 +-------- .../static/digitalglarus/js/booking.js | 30 +++-------- .../digitalglarus/booking_orders_detail.html | 3 +- .../templates/digitalglarus/login.html | 4 +- .../membership_deactivated_success.html | 54 +++++++++++++++++++ .../membership_orders_detail.html | 2 +- digitalglarus/urls.py | 5 +- digitalglarus/views.py | 14 ++++- 8 files changed, 84 insertions(+), 53 deletions(-) create mode 100644 digitalglarus/templates/digitalglarus/membership_deactivated_success.html diff --git a/digitalglarus/forms.py b/digitalglarus/forms.py index cb3a0465..cb7ede7a 100644 --- a/digitalglarus/forms.py +++ b/digitalglarus/forms.py @@ -60,37 +60,14 @@ class BookingBillingForm(BillingAddressForm): class BookingDateForm(forms.Form): start_date = forms.DateField(required=False, widget=forms.TextInput(attrs={'id': 'booking-date-1', - 'value': ''})) + 'value': 'Select your date'})) end_date = forms.DateField(required=False, widget=forms.TextInput(attrs={'id': 'booking-date-2'})) - # def clean_date_range(self): - # date_range = self.cleaned_data.get('date_range') - # dates = date_range.replace(' ', '').split('-') - # try: - # start_date, end_date = [datetime.strptime(date_string, "%m/%d/%Y").date() - # for date_string in dates] - # except ValueError: - # raise forms.ValidationError("Submit valid dates.") - - # if start_date > end_date: - # raise forms.ValidationError("Your end date must be greather than your start date.") - - # q1 = Q(start_date__lte=start_date, end_date__gte=start_date) - # q2 = Q(start_date__gt=start_date, start_date__lte=end_date) - # if Booking.objects.filter(q1 | q2).exists(): - # raise forms.ValidationError("You already have a booking in these dates.") - - # return start_date, end_date - def clean_start_date(self): start_date = self.cleaned_data.get('start_date') if not start_date: raise forms.ValidationError("This field is required.") - # try: - # start_date = datetime.strptime(start_date, "%m/%d/%Y").date() - # except ValueError: - # raise forms.ValidationError("Submit valid dates.") return start_date def clean_end_date(self): diff --git a/digitalglarus/static/digitalglarus/js/booking.js b/digitalglarus/static/digitalglarus/js/booking.js index 6ec5e0fd..814d1a3c 100644 --- a/digitalglarus/static/digitalglarus/js/booking.js +++ b/digitalglarus/static/digitalglarus/js/booking.js @@ -7,14 +7,16 @@ $( document ).ready(function() { var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000); + $('#booking-date-1').datetimepicker({ - // minDate: tomorrow, - format: 'MM/d/YYYY', - defaultDate: false + minDate: tomorrow, + format: 'MM/DD/YYYY', + // defaultDate: false }); + $('#booking-date-1').val(''); $('#booking-date-2').datetimepicker({ useCurrent: false, //Important! See issue #1075 - format: 'MM/d/YYYY', + format: 'MM/DD/YYYY', }); $("#booking-date-1").on("dp.change", function (e) { $('#booking-date-2').data("DateTimePicker").minDate(e.date); @@ -23,24 +25,4 @@ $( document ).ready(function() { $('#booking-date-1').data("DateTimePicker").maxDate(e.date); }); - - // var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000); - // // var tomorrow = today.setDate(today.getDate() + 1); - // $('#booking-date-range').daterangepicker({ - // autoUpdateInput: false, - // locale: { - // cancelLabel: 'Clear' - // }, - // minDate: tomorrow, - // }); - - - // $('#booking-date-range').on('apply.daterangepicker', function(ev, picker) { - // $(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY')); - // }); - - // $('#booking-date-range').on('dp.cancel', function(ev, picker) { - // $(this).val('Select your dates'); - // }); - }); \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/booking_orders_detail.html b/digitalglarus/templates/digitalglarus/booking_orders_detail.html index 6dcb604a..d4dac3b7 100644 --- a/digitalglarus/templates/digitalglarus/booking_orders_detail.html +++ b/digitalglarus/templates/digitalglarus/booking_orders_detail.html @@ -7,6 +7,7 @@ .invoice-title{ text-align: center !important; } +