Open willkg opened 11 years ago
Sounds good to me.
Note that we already have an updated field that is changed every time a Video is saved. That leaves us just with points 2 & 3. Unless we somewhere update video data directly (i.e. Video.objects.update), then we have to set the data manually.
For 1, I meant "show the last-updated data for the videos in the category video tab page". It should be a quick template change.
I think I wrote up another issue about how there are certain changes you can make related to M2M fields that don't update the updated field. Regardless, those should be uninteresting cases in respects to this so we can deal with them separately.
I added a really simple interface for this in 80b9a63937d34f08d621dda9ed41fa663fbb92d4. Sorting by title is ascending, creation and update date is descending (newest first).
Didn't work on 3 so far.
About storing the preference in a cookie, I've been thinking about it and I'm not sure what you mean.
path
set, cookies will only be send when needed, however, we would be storing a lot of cookies on the client (not sure what the domain limits are).If someone is logged in, they have a session. Definitely store it there. And I would store a separate one for each category. You could create a key like "category-sort-{id}"
then have it be a tuple of something like (column, asc/desc)
. That should be fine.
A good default might reduce the page reloads, so the server load would be reduced. (I vote for the last updated date)
Is it possible to gather some usage data in the current state?
When sorting by dates, please use a secondary sort order by title, it would preserve the order for series recorded in the same day (like 'ABC part 1 - xxx', 'ABC part 2 - yyy', and so on)
Three thoughts:
There is a good reason for using small commits :wink:
@squiddy please submit a patch for showing the last updated date, and another one for the default sort order (ascending by name). After all, the code was already written :smile:
@alexandrul No... A small patch for the last updated date is fine, but the code is not already written for sorting. I suspect it'll require a restructuring of the page to do the sorting in JS.
@willkg just the default sort order, no UI changes:
videos = (obj.video_set.live().select_related('category')
- .prefetch_related('speakers'))
+ .prefetch_related('speakers')
+ .order_by('title'))
@alexandrul Ahh... Ok. I don't want to change that sort order.
@alexandrul Feel free to work on it, I won't.
Some categories can contain a gazillion videos. That's problematic because it's hard to find what you're looking for. Further, if the category page changes, it's difficult to know what changed (e.g. what videos were recently updated).
I suggest at least the following:
I think this should cover just the videos tab for now. We can think about the other tabs in other issues.
Does this sound like a good way of fixing the problem without adding a ton of complexity?