Hello!

As generic relations have no equivalents in the world of SQL
relationships (1:1, 1:n, n:m), but it is rather a mix of DB technology
and programming language, there is no easy way to solve your problem.
Although you could combine something with lists of objects in Python
level.

Maybe the following functions will be helpful for you:
ct = ContentType.objects.get_for_model(SomeModel)
my_record = ct.get_object_for_this_type (pk=object_id)

Good luck!
Aidas Bendoraitis [aka Archatas]


On 9/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I went through GenericRelation's today as I was harassed several times
> to, and I found nothing that would help at all for what I'm trying to
> accomplish.
>
> Here are the updated models:
>
> class Score(models.Model):
>         content_type = models.ForeignKey(ContentType, db_index=True)
>         object_id = models.PositiveIntegerField(db_index=True)
>
>         score = models.IntegerField(default=0)
>
>         class Meta:
>                 unique_together = (('content_type', 'object_id'),)
>                 verbose_name = _('score')
>                 verbose_name_plural = _('scores')
>
> class Rating(models.Model):
>         score = models.ForeignKey(Score, db_index=True)
>
>         user = models.ForeignKey(UserExt, null=True, db_index=True)
>         ip = models.IPAddressField()
>         rating = models.SmallIntegerField(maxlength=1, choices=SCORE_CHOICES)
>         post_date = models.DateTimeField(auto_now=True, editable=False)
>
>         class Meta:
>                 unique_together = (('score', 'user'),)
>                 ordering = ['-post_date']
>                 verbose_name = _('rating')
>                 verbose_name_plural = _('ratings')
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to