Is there an equivalent to JPA @embedded in django modeling

109 views
Skip to first unread message

Khanh Tran

unread,
Oct 2, 2013, 6:55:11 PM10/2/13
to django...@googlegroups.com
Lets say both Customer and Business have an Address. In JPA, we can store address attributes(street,city,state,zip) directly inside Customer and Business using @Embedded annotation.Is there an equivalent to @embedded in python without using ForeignKey field. 

Jonathan D. Baker

unread,
Oct 2, 2013, 11:48:06 PM10/2/13
to django...@googlegroups.com
Could you use an abstract base class to define the address fields and then inherit from that?

Sent from my iPhone

On Oct 2, 2013, at 4:55 PM, Khanh Tran <khanh...@gmail.com> wrote:

Lets say both Customer and Business have an Address. In JPA, we can store address attributes(street,city,state,zip) directly inside Customer and Business using @Embedded annotation.Is there an equivalent to @embedded in python without using ForeignKey field. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a3cc0fb3-93f1-4759-a30b-b91b22ae47d1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Khanh Tran

unread,
Oct 4, 2013, 8:40:10 PM10/4/13
to django...@googlegroups.com
Thank you, jondbaker. That works!
Reply all
Reply to author
Forward
0 new messages