from email.policy import default

from django.db import models

class Car(models.Model):
    marka = models.CharField(max_length=39)
    nr_rej = models.CharField(max_length=29)
    vin = models.CharField(max_length=29)
    data_przegladu = models.DateField()
    informacje = models.TextField(default="", blank=True)

    def __str__(self):
        return self.nr_rej


class Zdjecie(models.Model):
    car = models.ForeignKey(Car, on_delete=models.CASCADE, related_name="zdjecia")
    obraz = models.ImageField(upload_to='zdjecia/', null=True, blank=True)

    def __str__(self):
        return f"Zdjęcie dla: {self.car.nr_rej}"
