开发者

Extending Django-tagging, adding extra field to each tag?

开发者 https://www.devze.com 2022-12-24 04:36 出处:网络
We\'re coding together a Django app to handle reviews of newspaper articles. Each newspaper article model will an arbitrary number of tags associated with it. Also, each tag will have an optional ran

We're coding together a Django app to handle reviews of newspaper articles.

Each newspaper article model will an arbitrary number of tags associated with it. Also, each tag will have an optional ranking (0 to 10).

I was thinking of using django-tagging to do this (http://code.google.com/p/django-tagging/), but I'm 开发者_高级运维not sure of the best way to add the ranking to the system. Should I extend django-tagging somehow? (Not sure if this is possible, without changing django-tagging's actual code?). Or is there a better way of achieving this?

Cheers, Victor


I have the same problem as you. If I don't find a better aproach my solution would this:

class TagExtension(models.Model):
    name = models.CharField(max_length=50, primary_key='True')
    ranking = models.IntegerField()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号