commit unversioned files ;)
This commit is contained in:
+2
-1
@@ -1,7 +1,8 @@
|
||||
from django.urls import path
|
||||
|
||||
from booking.views import CreateBookingView
|
||||
from booking.views import CreateBookingView, BookingListView
|
||||
|
||||
urlpatterns = [
|
||||
path('client/', CreateBookingView.as_view(), name='client_booking'),
|
||||
path('employee_bookings', BookingListView.as_view(), name='employee_bookings'),
|
||||
]
|
||||
+10
-3
@@ -1,10 +1,10 @@
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import CreateView
|
||||
from django.views.generic import CreateView, ListView
|
||||
|
||||
from booking.forms import BookingCreateForm
|
||||
from booking.models import Booking
|
||||
from common.utils import filter_queryset_by_user
|
||||
from common.utils.utils import filter_queryset_by_user
|
||||
|
||||
|
||||
# Create your views here.
|
||||
@@ -42,4 +42,11 @@ class CreateBookingView(CreateView):
|
||||
form.instance.vehicles_left = form.cleaned_data.get('vehicles')
|
||||
if self.request.user.line:
|
||||
form.instance.line = self.request.user.line
|
||||
return super().form_valid(form)
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
class BookingListView(ListView):
|
||||
template_name = 'employee/booking-list.html'
|
||||
model = Booking
|
||||
context_object_name = 'bookings'
|
||||
paginate_by = 30 # Number of containers per page
|
||||
|
||||
Reference in New Issue
Block a user