Skip to content

Commit 6e3deaf

Browse files
author
jcob
committed
update model
1 parent 514c108 commit 6e3deaf

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

server/djangoapp/models.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Uncomment the following imports before adding the Model code
22

33
from django.db import models
4-
from django.utils.timezone import now
4+
#from django.utils.timezone import now
55
from django.core.validators import MaxValueValidator, MinValueValidator
6+
from django.contrib import admin
7+
from .models import CarMake, CarModel
68

79

810
# Create your models here.
@@ -33,7 +35,7 @@ def __str__(self):
3335

3436

3537
class CarModel(models.Model):
36-
car_make = models.ForeignKey(CarMake, on_delete=models.CASCADE) # Many-to-One relationship
38+
car_make = models.ForeignKey(CarMake, on_delete=models.CASCADE) #Many-to-One relationship
3739
name = models.CharField(max_length=100)
3840
CAR_TYPES = [
3941
('SEDAN', 'Sedan'),
@@ -46,16 +48,13 @@ class CarModel(models.Model):
4648
validators=[
4749
MaxValueValidator(2023),
4850
MinValueValidator(2015)
49-
])
51+
]
52+
)
5053
# Other fields as needed
5154

5255
def __str__(self):
5356
return self.name # Return the name as the string representation
5457

55-
56-
from django.contrib import admin
57-
from .models import CarMake, CarModel
58-
5958
# Registering models with their respective admins
6059
admin.site.register(CarMake)
6160
admin.site.register(CarModel)

0 commit comments

Comments
 (0)