Hi,

could anyone help me with this please?
I'm working on rating system. Each model that can be rated has ARating as a
parent.
My models:

class ARating(models.Model):
    """Each model which is using ratings should extend this class.
    """
    rates = generic.GenericRelation('Rating')
    
    class Meta:
        abstract = True


class Rating(models.Model):
    user = models.ForeignKey(User) # rated by
    value = models.PositiveSmallIntegerField(_('value')) # 1 to 5 (higher =
better)
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')
    
    __unicode__ = lambda self: unicode(self.user)
    
    class Meta:
        verbose_name = _('Rating')
        verbose_name_plural = _('Ratings')

and the questions are:
how should I write view for model Rating, also form? I want to have one view
for every model that can be rated. How should I pass rated model to view
function?

Thanks a lot!

Radovan
-- 
View this message in context: 
http://www.nabble.com/GenericRelation-tp19816925p19816925.html
Sent from the django-users mailing list archive at Nabble.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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to