commit unversioned files ;)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
from containers.models import Container
|
||||
|
||||
def get_container_for_booking(booking):
|
||||
filters = {
|
||||
'expedited': False,
|
||||
}
|
||||
|
||||
if booking.container_number:
|
||||
filters['container_number'] = booking.container_number
|
||||
else:
|
||||
filters['container_type'] = booking.container_type
|
||||
filters['line'] = booking.line
|
||||
|
||||
return Container.objects.filter(**filters).order_by('created_at').first()
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
from django.urls import include, path
|
||||
|
||||
from containers.views import ContainerReceive, ContainerExpedition, ContainerSearchView
|
||||
from containers.views import ContainerReceive, ContainerExpedition, ContainerSearchView, ContainersListView
|
||||
|
||||
urlpatterns = [
|
||||
path('search', ContainerSearchView.as_view(), name='container_search'),
|
||||
path('employee_containers', ContainersListView.as_view(), name='employee_containers'),
|
||||
path('<int:pk>/', include([
|
||||
path('receive', ContainerReceive.as_view(), name='container_receive'),
|
||||
path('expedition', ContainerExpedition.as_view(), name='container_expedition'),
|
||||
|
||||
+10
-3
@@ -1,9 +1,9 @@
|
||||
from django.shortcuts import render, redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.views import View
|
||||
from django.views.generic import CreateView, UpdateView, FormView
|
||||
from django.views.generic import CreateView, UpdateView, FormView, ListView
|
||||
|
||||
from common.utils import get_container_by_number
|
||||
from common.utils.utils import get_container_by_number
|
||||
from containers.forms import ContainerReceiveForm, ContainerExpeditionForm
|
||||
from containers.models import Container
|
||||
from preinfo.models import Preinfo
|
||||
@@ -94,5 +94,12 @@ class ContainerExpedition(UpdateView):
|
||||
|
||||
|
||||
|
||||
|
||||
class ContainersListView(ListView):
|
||||
template_name = 'employee/containers-list.html'
|
||||
model = Container
|
||||
context_object_name = 'containers'
|
||||
paginate_by = 30 # Number of containers per page
|
||||
# def get(self, request):
|
||||
# containers = Container.objects.order_by('-received_on').all()[:10] # Fetch the last 10 containers
|
||||
# return render(request, self.template_name, {'containers': containers})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user