Skip to content

Commit

Permalink
Run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ltan02 committed Nov 25, 2023
1 parent e02cdf0 commit aa28ed4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions backend/auction/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.db import models

from core.models import MainModel

Expand Down Expand Up @@ -36,11 +36,11 @@ class AuctionItem(MainModel):
content_object = GenericForeignKey("content_type", "object_id")

class Meta:
unique_together = ('auction_id', 'content_type', 'object_id')
unique_together = ("auction_id", "content_type", "object_id")

def clean(self):
# Restrict content_type to specific models
valid_models = ['vehicle', 'equipment', 'trailer']
valid_models = ["vehicle", "equipment", "trailer"]
if self.content_type.model not in valid_models:
raise ValidationError(f"ContentType must be one of {valid_models}")

Expand Down
2 changes: 1 addition & 1 deletion backend/bid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Bid(MainModel):

def clean(self):
# Restrict content_type to specific models
valid_models = ['vehicle', 'equipment', 'trailer']
valid_models = ["vehicle", "equipment", "trailer"]
if self.content_type.model not in valid_models:
raise ValidationError(f"ContentType must be one of {valid_models}")

Expand Down
8 changes: 4 additions & 4 deletions backend/vehicle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class UnitImage(MainModel):

def clean(self):
# Restrict content_type to specific models
valid_models = ['vehicle', 'equipment', 'trailer']
valid_models = ["vehicle", "equipment", "trailer"]
if self.content_type.model not in valid_models:
raise ValidationError(f"ContentType must be one of {valid_models}")

Expand All @@ -98,14 +98,14 @@ class SavedUnits(MainModel):
content_object = GenericForeignKey("content_type", "object_id")

class Meta:
unique_together = ('auction_id', 'bidder_id', 'object_id')
unique_together = ("auction_id", "bidder_id", "object_id")

def clean(self):
# Restrict content_type to specific models
valid_models = ['vehicle', 'equipment', 'trailer']
valid_models = ["vehicle", "equipment", "trailer"]
if self.content_type.model not in valid_models:
raise ValidationError(f"ContentType must be one of {valid_models}")

def save(self, *args, **kwargs):
self.clean()
super().save(*args, **kwargs)
super().save(*args, **kwargs)

0 comments on commit aa28ed4

Please sign in to comment.