Thanks!
class Address(models.Model):
line1 = models.Charfield(maxlength=100)
line2 = models.Charfield(maxlength=100, blank=True, null=True)
city = models.Charfield(maxlength=100)
state = models.Charfield(maxlength=2)
country = models.Charfield(maxlength=100)
zip = models.Charfield(maxlength=20)
class UseProfile(models.Model):
shipping_address = models.OneToOneField(Address)
billing_address = models.OneToOneField(Address)
Check out: http://www.djangoproject.com/documentation/models/one_to_one/
for more info on using OneToOne fields.
If you want it to be encapsulated in a class, define the class
separately and relate it back to the class it pertains to, say, with a
unique foreign key.
If you just want to control getting/setting, use a property:
http://www.djangoproject.com/documentation/models/properties/
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."