models.py 636 B

12345678910111213141516
  1. from django.db import models
  2. from s3direct.fields import S3DirectField
  3. class Car(models.Model):
  4. name = models.CharField(max_length=255, blank=False, null=False)
  5. year_of_manufacture = models.CharField(max_length=255, blank=False, null=False)
  6. price = models.CharField(max_length=255, blank=False, null=False)
  7. image = S3DirectField(dest='primary_destination', blank=True)
  8. video = S3DirectField(dest='primary_destination', blank=True)
  9. def __str__(self):
  10. """
  11. Return a string representation of the model instance
  12. """
  13. return f"{self.name} ({self.year_of_manufacture}) - {self.price}"