> #Create a chapter, have it automatically set the position

You may amend the model's save() method to do that for you:

   def save(self):
       # Fiddle with the positon field
       self.position = <whatever suits you>
       # And now the actual save operation
       super(Item, self).save()

> move_higher              Moves an item up one position
> move_lower               Moves an item down one position
> move_to_bottom       Moves an item to the bottom of the list
> move_to_top             Moves an item to the top of the list

For them, you'd need to have an operation that changes the 
position of this chapter an probably of all the other chapters. 
You could create them as methods of the model and then manually 
call them:

def move_higher():
   # find previous chapter
   # swap position of previous and this chapter

def move_lower():
   # find next chapter
   # swap position of next and this chapter

def move_to_bottom():
   # find last chapter
   # position = lastchapter.position+1

def move_to_top():
   # find first chapter
   # if first.position>0:
   #    position = first.position-1
   # else:
   #    tediously renumber most if not not all chapters

> remove_from_list       Removes an item from the list

chapter.delete()

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to