Implement a 'collections' parameter, aka django-positions

Issue #1 resolved
Tim Heap repo owner created an issue

django-positions has the concept of 'collections'. An item is ranked according to its position, but only against other members of its collection. Something similar could be implemented for this, such that an item can be featured within a 'collection'.

An example use case would be one featured item per category, or per author.

{{{ #!python # models.py class Story(models.Model): title = models.CharField(max_length=255) body = models.TextField(max_length=255)

author = models.ForeignKey('auth.User')

site_feature = FeatureField()
author_feature = FeatureField(collection='author')

}}} {{{ #!python # views.py def my_best_story(request): me = request.user my_best_story = Story.objects.get(author=me, author_feature=True)

or

def my_best_story(request): me = request.user my_best_story = me.story_set.filter(author_featue=True)

}}}

Comments (1)

  1. Log in to comment