Add IntelliJ IDEA project configuration files

This commit adds IntelliJ IDEA-specific configuration files for the project, including module setup, version control integration, inspection profiles, and workspace settings. These files facilitate development environment configuration for contributors using IntelliJ IDEA.
This commit is contained in:
2025-07-01 11:43:16 +03:00
parent daba5a8438
commit da83ae7afc
9 changed files with 74 additions and 20 deletions
+19
View File
@@ -0,0 +1,19 @@
from django import forms
from booking.models import Booking
class BookingBaseForm(forms.ModelForm):
"""
Base form for booking-related forms.
This can be extended by other booking forms.
"""
class Meta:
fields = '__all__'
model = Booking
class BookingCreateForm(BookingBaseForm):
class Meta(BookingBaseForm.Meta):
fields = ['number', 'vehicles', 'container_type', 'container_count', 'carrier', 'line', 'container_number']
+2 -1
View File
@@ -2,7 +2,7 @@ from django.db import models
from common.models import ContainerTypeModel, LinesModel, OperationModel
# Create your models here.
class BookingModel(models.Model):
class Booking(models.Model):
number = models.CharField(max_length=50, unique=True)
vehicles = models.CharField(blank=True, null=True)
container_type = models.ForeignKey(
@@ -11,6 +11,7 @@ class BookingModel(models.Model):
related_name='booking_container_types',
)
container_count = models.IntegerField()
container_expedited_count = models.IntegerField(default=0)
carrier = models.CharField(max_length=100, blank=True, null=True)
line = models.ForeignKey(
LinesModel,
+7
View File
@@ -0,0 +1,7 @@
from django.urls import path
from booking.views import CreateBookingView
urlpatterns = [
path('client/', CreateBookingView.as_view(), name='client_booking'),
]
+28 -7
View File
@@ -1,14 +1,35 @@
from django.shortcuts import render
from django.urls import reverse_lazy
from django.views.generic import CreateView
from booking.forms import BookingCreateForm
from booking.models import Booking
from common.utils import filter_queryset_by_user
# Create your views here.
class CreateBookingView(CreateView):
template_name = 'create-booking.html'
extra_context = {
'title': 'Create Booking',
'description': 'This is the create booking page.',
}
template_name = 'client-booking-content.html'
model = Booking
form_class = BookingCreateForm
success_url = reverse_lazy('dashboard')
def get(self, request, *args, **kwargs):
return render(request, self.template_name, self.extra_context)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
queryset = self.model.objects.all().order_by('-created_on')
user = self.request.user
# !!! important
queryset = filter_queryset_by_user( queryset, user)[:10]
# !!! important
context['recent'] = queryset
return context
def form_valid(self, form):
# todo more validation
form.instance.created_by = self.request.user.id
form.instance.updated_by = self.request.user.id
if self.request.user.line:
form.instance.line = self.request.user.line
return super().form_valid(form)