Audit log changes #70

Merged
ismail merged 31 commits from frontend into main 2025-06-12 17:20:18 +03:00
Showing only changes of commit f79a45b470 - Show all commits

View File

@ -951,6 +951,22 @@ class CarColorsUpdateView( LoginRequiredMixin, PermissionRequiredMixin, SuccessM
template_name = "inventory/add_colors.html"
success_message = _("Car finance details updated successfully")
permission_required = ["inventory.change_carfinance"]
def get_object(self, queryset=None):
"""
Retrieves the CarColors instance associated with the Car slug from the URL.
This ensures we are updating the colors for the correct car.
"""
# Get the car_slug from the URL keywords arguments
slug = self.kwargs.get('slug')
# If no car_slug is provided, it's an invalid request
if not slug:
# You might want to raise Http404 or a more specific error here
raise ValueError("Car slug is required to identify the colors to update.")
return get_object_or_404(models.CarColors, car__slug=slug)
def get_success_url(self):
return reverse("car_detail", kwargs={"slug": self.object.car.slug})