Mike,
         So, I tried your idea for reorganizing the models, and just 
removed Organization and instead setup
ContactOrOrganization as a class.  
It seemed to work ok, in terms of migrating fine.  However, the database 
now lacks a ContactsOrOrganization 
table.  
Oops, my mistake, it does have a table now for that model.  I wonder if I 
need a ForeignKey field in the ContactsOrOrganization table?
Bruce


Anyway, I will try to remove the ManyToMany statement from the Connections 
Model.  
I would then have one Contact or Organization maps to many Connection 
types.  

On Sunday, April 24, 2016 at 1:13:16 AM UTC-4, Mike Dewhirst wrote:
>
>
> I think you should rethink your Contact and Organization classes and see 
> if you can eliminate one or the other. A single table for both would 
> simplify the problem because the Connection class can implement as many 
> connections as you like. 
>
> For example ... 
>
> class ContactOrOrganization(etc): 
>      various detail fields ... 
>
> class Connection(etc): 
>      organization = ForeignKey("ContactOrOrganization", 
>          related_name="organization") 
>      contact = ForeignKey("ContactOrOrganization", 
>          related_name="contact") 
>
> Just because I used related_name that way means nothing. You can connect 
> contacts together or organizations together. Also, you can add other 
> fields to Connection with which to describe the relationship. 
>
> Mike 
>
> > I wanted to use the Organization as a foreign key on the Contact model. 
> > Â I could have more than one contact from 
> > an Organization. Â The Connection model is inspired by the Google Plus 
> > idea of "Circles" - e.g. friends, 
> > family, following, etc. Â  So, this would be a many-to-many 
> relationship. Â 
> > 
> > My problems are (1) I cannot create connections without specifying a 
> > contact. Â 
> > (2) If I was adding a contact using the admin interface, how do I allow 
> > no value for that foreign field 
> > or allow for some kind of ajax type of text completion? Â If a person is 
> > family or friend, I may not need 
> > to list an Organization for them. 
> > (3) I would like to support multiple connection types - e.g. following, 
> > employer, etc. 
> > 
> > So, here is my apps models.py file: 
> >  >>>> 
> > 
> > from django.db import models 
> > 
> > 
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/32dfa22a-0a55-4fdf-9da0-73152b1223aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to