From af6167f9d47182cc332ba4f4bdc65cc7ed890726 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Mon, 9 Oct 2017 22:32:36 -0400 Subject: Start the ugly process of cleaning up the views. Added a datepicker to the load date form. Added the 'load_number' field to the LoadCreate view --- app/dispatch/views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'app/dispatch/views.py') diff --git a/app/dispatch/views.py b/app/dispatch/views.py index 2e5093e..9dd60af 100644 --- a/app/dispatch/views.py +++ b/app/dispatch/views.py @@ -49,10 +49,12 @@ class LoadDateSort(DetailView): start_date, end_date, next_week, previous_week = get_week_dates(self.request.GET.get('date',None)) loads = self.get_object().load_set.filter(date__range=(start_date, end_date)).prefetch_related('company') context['loads'] = split_loads_by_day(loads,start_date,end_date) - context['start_date'] = formats.date_format(start_date, "SHORT_DATE_FORMAT") - context['end_date'] = formats.date_format(end_date, "SHORT_DATE_FORMAT") - context['next_week'] = formats.date_format(next_week, "SHORT_DATE_FORMAT") - context['previous_week'] = formats.date_format(previous_week, "SHORT_DATE_FORMAT") + + # Holy fucking shit this wasn't really necessary + context['start_date'] = start_date + context['end_date'] = end_date + context['next_week'] = next_week + context['previous_week'] = previous_week return context class FilteredListView(ListView): @@ -157,7 +159,7 @@ class LoadCreate(CreateView): template_name = "dispatch/loads/create.html" model = Load success_url = reverse_lazy('load_list') - fields = ['date', 'company','description','amount'] + fields = ['date', 'company', 'load_number', 'description','amount'] def get(self,request): if request.user.is_superuser: -- cgit v1.2.3