I know that property() is a built-in function in Python, but I want to name a model class as Property. Something simple like this:
class Property(models.Model):
name = models.CharField(max_length=135)
owner = models.ForeignKey(User, related_name='properties_from_owner')
address_line_one = models.CharField(max_length=135)
address_line_two = models.CharField(max_length=135, blank=True)
city = models.CharField(max_length=135)
state = models.CharField(max_length=135)
zip_code = models.CharField(max_length=135)
Should I call the class Property or Property_? Now I know Python is case-sensitive, but the reason I ask is because in Django the Property model class is identified as myapp.property.
In other models that relates to Property I added a _ to the fields like this
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='userprofile_from_user')
property_ = models.ForeignKey(Property, related_name='userprofiles_from_property')
propertyis not a keyword but a function. You could overwrite it if you want (while making sure you don’t mix up the two later in the file.In a situation where no mix-up is possible, I see no reason not to do it.