Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/OpenClassrooms-Student-Center/Python-OC-Lettings-FR/llms.txt

Use this file to discover all available pages before exploring further.

Orange County Lettings uses three Django models to represent its data: Address, Letting, and Profile. Each model is defined in oc_lettings_site/models.py.

Address

Represents a physical postal address for a letting property.
class Address(models.Model):
    number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)])
    street = models.CharField(max_length=64)
    city = models.CharField(max_length=64)
    state = models.CharField(max_length=2, validators=[MinLengthValidator(2)])
    zip_code = models.PositiveIntegerField(validators=[MaxValueValidator(99999)])
    country_iso_code = models.CharField(max_length=3, validators=[MinLengthValidator(3)])

    def __str__(self):
        return f'{self.number} {self.street}'
FieldTypeConstraints
numberPositiveIntegerFieldMax value: 9999
streetCharFieldMax length: 64 chars
cityCharFieldMax length: 64 chars
stateCharFieldExactly 2 chars (US state code)
zip_codePositiveIntegerFieldMax value: 99999
country_iso_codeCharFieldExactly 3 chars (ISO 3166-1 alpha-3 country code)
__str__ returns "{number} {street}" — for example, "27 Old Lyme Road".

Letting

Represents an individual holiday home listing, linked to a single Address.
class Letting(models.Model):
    title = models.CharField(max_length=256)
    address = models.OneToOneField(Address, on_delete=models.CASCADE)

    def __str__(self):
        return self.title
FieldTypeConstraints
titleCharFieldMax length: 256 chars
addressOneToOneFieldAddressDeletes the letting when the linked address is deleted (CASCADE)
__str__ returns the value of title.
The OneToOneField on address means each Address record can only be associated with a single Letting. Deleting an Address automatically deletes its linked Letting.

Profile

Extends Django’s built-in User model with an optional favourite city preference.
class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    favorite_city = models.CharField(max_length=64, blank=True)

    def __str__(self):
        return self.user.username
FieldTypeConstraints
userOneToOneFielddjango.contrib.auth.models.UserDeletes the profile when the linked user is deleted (CASCADE)
favorite_cityCharFieldMax length: 64 chars; optional (blank=True)
__str__ returns self.user.username.
favorite_city is optional — blank=True means the field can be left empty when saving via a form. The column is still created in the database; it simply accepts an empty string.

Build docs developers (and LLMs) love