I'm looking for a support for something like Eric Evans Value Objects
(http://domaindrivendesign.org/). For example, if I have a Person
model like

class Adress(models.Model):
    street = ...
    city = ...
    postal_code = ...

class Person(models.Model):
    home_adress = models.OneToOneField(Adress)
    business_adress = models.OneToOneField(Adress)

Adress is like a Value Object, but I don't want any adress table, nor
extra foreign key and database joins. My application is not made for a
National Post Office domain. I just want an Adress class whitout
database identity.

Another possibility I know is define a custom Field Type, but this one
seems a too difficult solution for such a simple task. Especially if
Adress is made form simple and obvious attributes.

If Person has only one Adress attribute, the inheritance likes such a
good solution, but if I want a second Adress, or I want an Adress with
null=True, inheritance si bad.

Can you give me some suggestions, how to implement Eric Evans's Value
Objects in Django?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to