Thanks a lot for the quick response.

On Thursday 14 January 2010 23:08:43 Shawn Milochik wrote:

> ...
> woman = Woman.objects.get(lastname__exact = 'Test')
> couple = Couple.objects.get(couple = woman.couple)
> 
> Note that this is making the assumption that there is only one woman with
>  that last name, and that there is only one couple with this woman in it.

And that may not be the case. In my example, there are 2 women with the same 
last name and I would like to get their couple ids individually, which will 
then enable me to get their relevant info from Couple model. Do you think it 
is possible to do that?

> I don't know if you just made this up as an example, but if it's something
>  that you're actually working on, it seems like making a Woman and Man
>  model isn't a very good idea because there's so much duplication. Just
>  have a Person model with a 'sex' field, and you have have a foreign key to
>  itself labeled 'partner' or something. No need for a separate 'couples'
>  table. If you really need the address info, there should be an Address
>  model. After all, you may have other things (businesses, etc.) that also
>  have addresses which will require the same validation. It gets really ugly
>  really fast when you have 'address1, address2, city, state, and zip' in a
>  bunch of different models. Possibly with different field lengths and other
>  stuff.

Thanks for the really very useful suggestions. I didn't think it that way 
really, but how about duplicate home addresses for the man and woman living 
together? Wouldn't there be a lot of redundant data that way? Would you mind 
recommending me some documentation to learn about foreign key to itself? I am 
not sure that I understand how it is set up.

> Also, I don't know what you mean by not having a technical background, but
>  if you mean you have no application design or programming experience, then
>  I urge you to hire someone to do this, unless this is just something
>  you're doing to teach yourself to program (and if so, welcome!). Despite
>  the fact that Python and Django are far less daunting to learn than other
>  tools, they still require programming ability to do at all, and a lot of
>  experience to do well. Nothing personal -- I just wanted to point out that
>  database design and application design are definitely not trivial and
>  shouldn't be done by someone with no experience if this is something
>  needed by your business.

Thanks for the fair warning Shawn. I cannot agree more. Although this looks 
like a business database set up, I have no intention to use it in a business 
setting. This will probably be my hobby project that I develop in my spare 
time over several months probably. I am well aware of the risks of collecting 
and storing personal information, let alone putting them on an online server 
without the expertise and experience of programming and security. Even if I 
believed I had those qualities, I would still not attempt to do that with this 
kind of information. I am just challenging myself with a very difficult task 
for 
my level, to learn python and django and gain some comfort in using them. I 
truly appreciate your sincere and rightful warnings.

Regards,

Hakan

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to