views:

38

answers:

1

So I have a list of models, don't think the structure of these models is important. In this case Articles.


So these Articles are ordered by popularity between a rank of 1 to 100, all the other articles have no ranks.

Whenever I update the rank of a model the model with equivalent rank must loose its rank.


Any ideas?

+1  A: 

Do you mean something like this?

def update_rank(rank, article):
      old = Article.object.get(rank=rank)
      old.rank = None
      old.save()
      article.rank = rank
      article.save()
gruszczy
Shouldn't the rank of the old one (and all the others below it) move down one, and the 100th item loose it's rank?
gnibbler