add doctstings

This commit is contained in:
2025-09-08 11:58:02 +02:00
parent 2fd139de55
commit dd5bccf708
6 changed files with 45 additions and 0 deletions

View File

@@ -3,6 +3,17 @@ from django.core.validators import MaxValueValidator, MinLengthValidator
class Address(models.Model):
"""
Details of the physical location of a property
"""
class Meta:
"""
Fix the plural displayed in admin
"""
verbose_name_plural = "Addresses"
number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)])
street = models.CharField(max_length=64)
city = models.CharField(max_length=64)
@@ -11,12 +22,18 @@ class Address(models.Model):
country_iso_code = models.CharField(max_length=3, validators=[MinLengthValidator(3)])
def __str__(self):
""" Display object with basic address """
return f'{self.number} {self.street}'
class Letting(models.Model):
"""
Announce for a property to rent
"""
title = models.CharField(max_length=256)
address = models.OneToOneField(Address, on_delete=models.CASCADE)
def __str__(self):
""" display object with title """
return self.title