Re: Need help with this basic query (annotate vs aggregate)

2011-03-03 Thread Steven Sacks
Also, I need to get back Playlist records (hence the select_releated()). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to

Re: Need help with this basic query (annotate vs aggregate)

2011-03-03 Thread Steven Sacks
If it helps, this is, I believe, somewhat equivalent SQL: SELECT playlist_id, tag, SUM(tag_count) score FROM playlist_tag WHERE tag like '%query%' GROUP BY playlist_id ORDER BY score DESC -- You received this message because you are subscribed to the Google Groups "Django users"

Need help with this basic query (annotate vs aggregate)

2011-03-03 Thread Steven Sacks
Here is my model: class PlaylistTag(models.Model): playlist = models.ForeignKey(Playlist) tag = models.CharField(max_length=128) tag_count = models.PositiveIntegerField(default=1) The way this model works is simple. If you add a tag to a playlist, and the tag doesn't exist, the

Re: Manually sorting items in a table - Doubly-Linked List vs sort_index

2010-10-08 Thread Steven Sacks
Sorry I accidentally repeated myself. List Delete closes gaps by setting item.prev = item.next and item.next = item.prev. On Oct 8, 5:03 am, Steven Sacks <stevensa...@gmail.com> wrote: > While I appreciate your response, your assumption is incorrect. > However, I've found the solut

Re: Manually sorting items in a table - Doubly-Linked List vs sort_index

2010-10-08 Thread Steven Sacks
While I appreciate your response, your assumption is incorrect. However, I've found the solution and it's rather easy. The List Delete function closes gaps by setting an item.prev = item.next and item.prev = item.next The List Insert function injects item(s) either at the end of the list (when

Manually sorting items in a table - Doubly-Linked List vs sort_index

2010-10-06 Thread Steven Sacks
I've got items in a list that a user can arbitrarily move around in whatever order they want. Additionally, they can add a group of items to a list in a specific position within that list. Further, they can sort multiple items at once, meaning they can select one to many, sequential or