Re: OneToMany relationshops between models?

2008-04-28 Thread [EMAIL PROTECTED]

Yes django.contrib.comments is scheduled to be rewritten as a part of
the Google Summer of Code.

On Apr 29, 12:01 am, Mike Chambers <[EMAIL PROTECTED]> wrote:
> Thanks.
>
> Ill take a look at that, as well as some of the other comments framework.
>
> I had looked at the django  comments, but it looked like it wasnt really
> supported, and might change soon.
>
> mike chambers
>
> [EMAIL PROTECTED] wrote:
> > For something like this the best way to do this is a generic foreign
> > key, here is an 
> > example:http://www.djangoproject.com/documentation/models/generic_relations/
> > .  For comments though you should probably check out,
> > django.contrib.comments, or one of the other open source comment
> > packages(such as threadedcomments).
>
> > On Apr 28, 11:40 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
> >> I am writing my first django app. I have Items, which can have multiple
> >> comments associated with them.
>
> >> Normally, I could express this in my model as:
>
> >> ---
> >> class Comment(models.Model):
> >>         comment = models.TextField(core=True)
> >>         item = models.ForeignKey(Item)
>
> >> class Item(models.Model):
> >>         name = models.CharField(core=True, max_length=255, unique=True)
> >> ---
>
> >> However, I am trying to learn to split my project up into individual
> >> applications, and have thus put the comment functionality in its own
> >> app. I dont mind if the Item app knows about the Comment app, but I
> >> don't want to Comment app to reference the Item app (so I can use
> >> comments with other apps / types in the future).
>
> >> So, is there anyway to express a OneToMany relationship from the Item?
> >> Something like:
>
> >> class Comment(models.Model):
> >>         comment = models.TextField(core=True)
>
> >> class Item(models.Model):
> >>         name = models.CharField(core=True, max_length=255, unique=True)
> >>         comments = models.OneToMany(Comment)
>
> >> That would accomplish the same as above, but would allow me to keep my
> >> Comment model from having to know what type of objects it is being
> >> associated with.
>
> >> I apologize if this has an obvious answer. Again, I am new to django,
> >> and trying to work my way through the best way to use the framework
> >> (which I love, btw).
>
> >> mike chambers
>
>
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: OneToMany relationshops between models?

2008-04-28 Thread Mike Chambers

Thanks.

Ill take a look at that, as well as some of the other comments framework.

I had looked at the django  comments, but it looked like it wasnt really 
supported, and might change soon.

mike chambers


[EMAIL PROTECTED] wrote:
> For something like this the best way to do this is a generic foreign
> key, here is an example: 
> http://www.djangoproject.com/documentation/models/generic_relations/
> .  For comments though you should probably check out,
> django.contrib.comments, or one of the other open source comment
> packages(such as threadedcomments).
> 
> On Apr 28, 11:40 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
>> I am writing my first django app. I have Items, which can have multiple
>> comments associated with them.
>>
>> Normally, I could express this in my model as:
>>
>> ---
>> class Comment(models.Model):
>> comment = models.TextField(core=True)
>> item = models.ForeignKey(Item)
>>
>> class Item(models.Model):
>> name = models.CharField(core=True, max_length=255, unique=True)
>> ---
>>
>> However, I am trying to learn to split my project up into individual
>> applications, and have thus put the comment functionality in its own
>> app. I dont mind if the Item app knows about the Comment app, but I
>> don't want to Comment app to reference the Item app (so I can use
>> comments with other apps / types in the future).
>>
>> So, is there anyway to express a OneToMany relationship from the Item?
>> Something like:
>>
>> class Comment(models.Model):
>> comment = models.TextField(core=True)
>>
>> class Item(models.Model):
>> name = models.CharField(core=True, max_length=255, unique=True)
>> comments = models.OneToMany(Comment)
>>
>> That would accomplish the same as above, but would allow me to keep my
>> Comment model from having to know what type of objects it is being
>> associated with.
>>
>> I apologize if this has an obvious answer. Again, I am new to django,
>> and trying to work my way through the best way to use the framework
>> (which I love, btw).
>>
>> mike chambers
> > 

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: OneToMany relationshops between models?

2008-04-28 Thread [EMAIL PROTECTED]

For something like this the best way to do this is a generic foreign
key, here is an example: 
http://www.djangoproject.com/documentation/models/generic_relations/
.  For comments though you should probably check out,
django.contrib.comments, or one of the other open source comment
packages(such as threadedcomments).

On Apr 28, 11:40 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
> I am writing my first django app. I have Items, which can have multiple
> comments associated with them.
>
> Normally, I could express this in my model as:
>
> ---
> class Comment(models.Model):
>         comment = models.TextField(core=True)
>         item = models.ForeignKey(Item)
>
> class Item(models.Model):
>         name = models.CharField(core=True, max_length=255, unique=True)
> ---
>
> However, I am trying to learn to split my project up into individual
> applications, and have thus put the comment functionality in its own
> app. I dont mind if the Item app knows about the Comment app, but I
> don't want to Comment app to reference the Item app (so I can use
> comments with other apps / types in the future).
>
> So, is there anyway to express a OneToMany relationship from the Item?
> Something like:
>
> class Comment(models.Model):
>         comment = models.TextField(core=True)
>
> class Item(models.Model):
>         name = models.CharField(core=True, max_length=255, unique=True)
>         comments = models.OneToMany(Comment)
>
> That would accomplish the same as above, but would allow me to keep my
> Comment model from having to know what type of objects it is being
> associated with.
>
> I apologize if this has an obvious answer. Again, I am new to django,
> and trying to work my way through the best way to use the framework
> (which I love, btw).
>
> mike chambers
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---