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-06-30 18:06:35 +03:00
parent 72e0fc963c
commit daba5a8438
51 changed files with 2686 additions and 1377 deletions
+33
View File
@@ -0,0 +1,33 @@
from django.forms import ModelForm
from containers.models import Container
class ContainerBaseForm(ModelForm):
class Meta:
model = Container
fields = '__all__'
class ContainerReceiveForm(ContainerBaseForm):
"""
Form for creating a new Container instance.
Inherits from ContainerBaseForm.
"""
class Meta(ContainerBaseForm.Meta):
fields = ['number', 'receive_vehicle', 'damages', 'heavy_damaged', 'position',]
class ContainerExpeditionForm(ContainerBaseForm):
"""
Form for updating an existing Container instance.
Inherits from ContainerBaseForm.
"""
class Meta(ContainerBaseForm.Meta):
exclude = ['created_on',
'created_by',
'deleted',
'deleted_on',
'deleted_by',
'received'] # Exclude fields that should not be set by the user
-112
View File
@@ -1,112 +0,0 @@
# Generated by Django 5.2.3 on 2025-06-25 12:33
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("booking", "0001_initial"),
("common", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="Container",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("number", models.CharField(max_length=11)),
("received_on", models.DateTimeField(auto_now_add=True)),
("received_by", models.IntegerField()),
(
"receive_vehicles",
models.CharField(blank=True, max_length=100, null=True),
),
("damages", models.TextField(blank=True, null=True)),
("heavy_damaged", models.BooleanField(default=False)),
("position", models.CharField(blank=True, max_length=100, null=True)),
("swept", models.BooleanField(default=False)),
("swept_on", models.DateTimeField(blank=True, null=True)),
("swept_by", models.IntegerField(blank=True, null=True)),
("washed", models.BooleanField(default=False)),
("washed_on", models.DateTimeField(blank=True, null=True)),
("washed_by", models.IntegerField(blank=True, null=True)),
("expedited", models.BooleanField(default=False)),
("expedited_on", models.DateTimeField(blank=True, null=True)),
("expedited_by", models.IntegerField(blank=True, null=True)),
(
"expedition_vehicle",
models.CharField(blank=True, max_length=100, null=True),
),
(
"booking",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="container_bookings",
to="booking.bookingmodel",
),
),
(
"container_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="container_container_types",
to="common.containertypemodel",
),
),
(
"line_id",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="container_lines",
to="common.linesmodel",
),
),
],
),
migrations.CreateModel(
name="ContainerHistory",
fields=[
(
"container_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="containers.container",
),
),
("operation_date", models.DateTimeField(auto_now_add=True)),
(
"container",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="history_containers",
to="containers.container",
),
),
(
"operation",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="history_operations",
to="common.operationmodel",
),
),
],
bases=("containers.container",),
),
]
+30 -6
View File
@@ -4,7 +4,7 @@ from common.models import LinesModel, ContainerTypeModel
# Create your models here.
class Container(models.Model):
number = models.CharField(max_length=11)
line_id = models.ForeignKey(
line = models.ForeignKey(
LinesModel,
on_delete=models.CASCADE,
related_name='container_lines',
@@ -15,25 +15,49 @@ class Container(models.Model):
related_name='container_container_types',
)
received_on = models.DateTimeField(auto_now_add=True)
received_by = models.IntegerField()
receive_vehicles = models.CharField(max_length=100, blank=True, null=True)
received_by = models.ForeignKey(
'accounts.DepotUser',
on_delete=models.CASCADE,
related_name='container_received_by',
)
receive_vehicle = models.CharField(max_length=100, blank=True, null=True)
damages = models.TextField(blank=True, null=True)
heavy_damaged = models.BooleanField(default=False)
position = models.CharField(max_length=100, blank=True, null=True)
swept = models.BooleanField(default=False)
swept_on = models.DateTimeField(blank=True, null=True)
swept_by = models.IntegerField(blank=True, null=True)
swept_by = models.ForeignKey(
'accounts.DepotUser',
on_delete=models.CASCADE,
related_name='container_swept_by',
blank=True,
null=True
)
washed = models.BooleanField(default=False)
washed_on = models.DateTimeField(blank=True, null=True)
washed_by = models.IntegerField(blank=True, null=True)
washed_by = models.ForeignKey(
'accounts.DepotUser',
on_delete=models.CASCADE,
related_name='container_washed_by',
blank=True,
null=True
)
booking = models.ForeignKey(
'booking.BookingModel',
on_delete=models.CASCADE,
related_name='container_bookings',
blank = True,
null = True
)
expedited = models.BooleanField(default=False)
expedited_on = models.DateTimeField(blank=True, null=True)
expedited_by = models.IntegerField(blank=True, null=True)
expedited_by = models.ForeignKey(
'accounts.DepotUser',
on_delete=models.CASCADE,
related_name='container_expedited_by',
blank=True,
null=True
)
expedition_vehicle = models.CharField(max_length=100, blank=True, null=True)
+11
View File
@@ -0,0 +1,11 @@
from django.urls import include, path
from containers.views import ContainerReceive, ContainerExpedition, ContainerSearchView
urlpatterns = [
path('search', ContainerSearchView.as_view(), name='container_search'),
path('<int:pk>/', include([
path('receive', ContainerReceive.as_view(), name='container_receive'),
path('expedition', ContainerExpedition.as_view(), name='container_expedition'),
])),
]
+96 -1
View File
@@ -1,3 +1,98 @@
from django.shortcuts import render
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 common.utils import get_container_by_number
from containers.forms import ContainerReceiveForm, ContainerExpeditionForm
from containers.models import Container
from preinfo.models import Preinfo
# Create your views here.
class ContainerReceive(CreateView):
template_name = 'container-receive.html'
model = Container
form_class = ContainerReceiveForm
success_url = reverse_lazy('dashboard')
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
pk = self.kwargs.get('pk')
try:
preinfo =Preinfo.objects.filter(pk=pk, received=False).first()
except Preinfo.DoesNotExist:
preinfo = None
if preinfo:
context['preinfo'] = preinfo
context['containers'] = Container.objects.order_by('-received_on').all()[:10] # Fetch the last 10 containers
return context
return redirect(reverse_lazy('container_search'))
def form_valid(self, form):
# Get the preinfo_id from the POST data
preinfo_id = self.request.POST.get('preinfo_id')
try:
preinfo = Preinfo.objects.get(id=preinfo_id)
except Preinfo.DoesNotExist:
preinfo = None
# validate if data is correct, comparing user data with preinfo data
if preinfo and preinfo.container_number == form.cleaned_data.get('number') and not preinfo.received:
preinfo.received = True
preinfo.save()
form.instance.received_by = self.request.user
form.instance.line = preinfo.line
form.instance.container_type = preinfo.container_type
else:
form.add_error('number', 'Invalid data')
return super().form_valid(form)
class ContainerSearchView(View):
template_name = 'container-search.html'
def get(self, request):
return render(request, self.template_name)
def post(self, request):
number = request.POST.get('number')
container = get_container_by_number(number)
if container:
if container.booking:
next_url = request.POST.get('param')
return redirect(next_url, pk=container.booking.pk)
else:
return render(request, self.template_name, {'error': 'Booking not found'})
return render(request, self.template_name, {'error': 'Not found'})
class ContainerExpedition(UpdateView):
template_name = 'container-expedition.html'
model = Container
form_class = ContainerExpeditionForm
success_url = reverse_lazy('dashboard')
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
pk = self.kwargs.get('pk')
try:
preinfo =Preinfo.objects.filter(pk=pk, received=False).first()
except Preinfo.DoesNotExist:
preinfo = None
if preinfo:
context['preinfo'] = preinfo
context['containers'] = Container.objects.order_by('-received_on').all()[:10] # Fetch the last 10 containers
return context
return redirect(reverse_lazy('container_search'))