1. Tim Heap
  2. django-featured-item
  3. Issues
Issue #1 resolved

Implement a 'collections' parameter, aka django-positions

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.




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')

}}} {{{



def my_best_story(request): me = request.user my_best_story = Story.objects.get(author=me, author_feature=True)


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