File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
1
# Uncomment the following imports before adding the Model code
2
2
3
3
from django .db import models
4
- from django .utils .timezone import now
4
+ # from django.utils.timezone import now
5
5
from django .core .validators import MaxValueValidator , MinValueValidator
6
+ from django .contrib import admin
7
+ from .models import CarMake , CarModel
6
8
7
9
8
10
# Create your models here.
@@ -33,7 +35,7 @@ def __str__(self):
33
35
34
36
35
37
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
37
39
name = models .CharField (max_length = 100 )
38
40
CAR_TYPES = [
39
41
('SEDAN' , 'Sedan' ),
@@ -46,16 +48,13 @@ class CarModel(models.Model):
46
48
validators = [
47
49
MaxValueValidator (2023 ),
48
50
MinValueValidator (2015 )
49
- ])
51
+ ]
52
+ )
50
53
# Other fields as needed
51
54
52
55
def __str__ (self ):
53
56
return self .name # Return the name as the string representation
54
57
55
-
56
- from django .contrib import admin
57
- from .models import CarMake , CarModel
58
-
59
58
# Registering models with their respective admins
60
59
admin .site .register (CarMake )
61
60
admin .site .register (CarModel )
You can’t perform that action at this time.
0 commit comments