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:
+18
-2
@@ -3,6 +3,13 @@ from common.models import ContainerTypeModel, LinesModel, OperationModel
|
||||
|
||||
# Create your models here.
|
||||
class Booking(models.Model):
|
||||
|
||||
STATUS_CHOICES = [
|
||||
('active', 'Active'),
|
||||
('finished', 'Finished'),
|
||||
('canceled', 'Canceled'),
|
||||
]
|
||||
|
||||
number = models.CharField(max_length=50, unique=True)
|
||||
vehicles = models.CharField(blank=True, null=True)
|
||||
container_type = models.ForeignKey(
|
||||
@@ -21,8 +28,17 @@ class Booking(models.Model):
|
||||
visible = models.BooleanField(default=True)
|
||||
is_new = models.BooleanField(default=True)
|
||||
container_number = models.CharField(max_length=11, blank=True, null=True)
|
||||
vehicles_left = models.IntegerField(blank=True, null=True)
|
||||
vehicles_left = models.CharField(blank=True, null=True)
|
||||
created_on = models.DateTimeField(auto_now_add=True)
|
||||
created_by = models.IntegerField()
|
||||
updated_on = models.DateTimeField(auto_now=True)
|
||||
updated_by = models.IntegerField()
|
||||
updated_by = models.IntegerField()
|
||||
status = models.CharField(
|
||||
max_length=10,
|
||||
choices=STATUS_CHOICES,
|
||||
default='active'
|
||||
)
|
||||
|
||||
@property
|
||||
def containers_left(self):
|
||||
return self.container_count - (self.container_expedited_count or 0)
|
||||
+12
-2
@@ -12,7 +12,7 @@ class CreateBookingView(CreateView):
|
||||
template_name = 'client-booking-content.html'
|
||||
model = Booking
|
||||
form_class = BookingCreateForm
|
||||
success_url = reverse_lazy('dashboard')
|
||||
success_url = reverse_lazy('client_booking')
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
@@ -21,15 +21,25 @@ class CreateBookingView(CreateView):
|
||||
# !!! important
|
||||
queryset = filter_queryset_by_user( queryset, user)[:10]
|
||||
# !!! important
|
||||
|
||||
context['recent'] = queryset
|
||||
return context
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
user = self.request.user
|
||||
|
||||
# If user has a specific line, limit the line choices
|
||||
if user.line:
|
||||
form.fields['line'].queryset = form.fields['line'].queryset.filter(pk=user.line.pk)
|
||||
form.fields['line'].initial = user.line
|
||||
form.fields['line'].widget.readonly = True #attrs['disabled'] = True
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
# todo more validation
|
||||
form.instance.created_by = self.request.user.id
|
||||
form.instance.updated_by = self.request.user.id
|
||||
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)
|
||||
Reference in New Issue
Block a user