Re: How to handle person to person relationships
I know that but my problem is that it is still undocumented. I am an absolute newbie in case of django and web development in python. Though I have used python for quite some time. CAn you provide some link that documents content-type system. On 8/30/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 8/30/06, Mir Nazim <[EMAIL PROTECTED]> wrote: > > Now comes another problem, I have read generic relationships document > > at django site. but can anyone point me to some urls where thing like > > content-type etc(that are need for generic relationship to work) > > described in detail. The solution defined in that document > > http://www.djangoproject.com/documentation/models/generic_relations/ > > seem cool and usable. just need to understand the background more > > django.contrib.comments uses contenttype pretty extensively: > http://code.djangoproject.com/browser/django/trunk/django/contrib/comments > > > > -- MA SALAAM - Mir Nazim http://mirnazim.wordpress.com - XenSoft Labshttp://www.xensoftlabs.com - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to handle person to person relationships
On 8/30/06, Mir Nazim <[EMAIL PROTECTED]> wrote: > Now comes another problem, I have read generic relationships document > at django site. but can anyone point me to some urls where thing like > content-type etc(that are need for generic relationship to work) > described in detail. The solution defined in that document > http://www.djangoproject.com/documentation/models/generic_relations/ > seem cool and usable. just need to understand the background more django.contrib.comments uses contenttype pretty extensively: http://code.djangoproject.com/browser/django/trunk/django/contrib/comments --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to handle person to person relationships
Jeremy Dunck wrote: > On 8/29/06, Mir Nazim <[EMAIL PROTECTED]> wrote: > > > > I have already gone through that. but problem is that I need to add > > some attributes to relationships like > > > > he is my best friend > > i have not met him > > > > something like orkut. > > If you're going to attach view and template behavior based on the > different relationship types as you add them, then I think it makes > sense to just have a separate attribute field on the Person model for > each relationship type. > > class Person(models.Model): > ... >contacts = models.ManyToManyField('self') >friends = models.ManyToManyField('self') >enemies = models.ManyToManyField('self') Yes you are right, Jermy, That is the approach we are taking now. actually now it will be only contacts field. All ther classification will be handled using a generic taxonomy system(taging). Now comes another problem, I have read generic relationships document at django site. but can anyone point me to some urls where thing like content-type etc(that are need for generic relationship to work) described in detail. The solution defined in that document http://www.djangoproject.com/documentation/models/generic_relations/ seem cool and usable. just need to understand the background more Regards Mir Nazim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to handle person to person relationships
On 8/29/06, Mir Nazim <[EMAIL PROTECTED]> wrote: > > I have already gone through that. but problem is that I need to add > some attributes to relationships like > > he is my best friend > i have not met him > > something like orkut. If you're going to attach view and template behavior based on the different relationship types as you add them, then I think it makes sense to just have a separate attribute field on the Person model for each relationship type. class Person(models.Model): ... contacts = models.ManyToManyField('self') friends = models.ManyToManyField('self') enemies = models.ManyToManyField('self') --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to handle person to person relationships
I have already gone through that. but problem is that I need to add some attributes to relationships like he is my best friend i have not met him something like orkut. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to handle person to person relationships
http://www.djangoproject.com/documentation/models/m2m_recursive/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
How to handle person to person relationships
How code the relationship like "a person has many friends" code so far. class Person(models.Model): full_name = models.CharField(maxlength=100) nick_name = models.CharField(maxlength=20) about = models.TextField(blank=True) sex = models.CharField(maxlength=1, choices=SEXES) # contact is also a person object so it is a reference to same person # more study needs to be done on how to add attributes to ManyToMany relationship in Django # e.g. we may need to define whether a contact is my friend etc. # creating a separate class for Contact may not be the a good solution, since a Contact is also a Person contacts = models.ManyToManyField('self') Or like this class PersonRelation(models.Model): person = models.ForeignKey(Person) relations = models.ManyToManyField(Person, related_name = 'friends') type = models.IntegerField(choices=FRIEND_TYPES) group = models.IntegerField(choices=GROUP_TYPES) please highlight pros and cons. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---