python - Django sort by Articles with most similar tags -


i have model articles , tags, using filter suggestions.

the article tags tags = article.tags.all() filter article.objects.filter(tags__in=tags)[:5] i'd add sort tags similar.

model article , tags

class article(models.model):     ...     tags = models.foreignkey(tag, blank=true, null=true)  class tag(models.model):     name = models.charfield(max_length=20, blank=true) 

i suggest use app django-taggit. taggablemanager has method similar_objects want.


Comments

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -