Show a user's bots in the order they were created.

Showing a user's bots in alphabetical order leads to a mildly
confusing experience when we append a new bot to the end of the
table, but then you hit refresh, and the new bot goes to a different
position.  Since any given user is unlikely to have zillions of
bots, I don't think we need alphabetical order to help them find
old bots.

(imported from commit 4f19dbd7a016e7d867e88248190849dcd52c6d71)
This commit is contained in:
Steve Howell 2013-06-27 17:05:36 -04:00
parent b6d7079ec9
commit 0f3b6cd863
2 changed files with 4 additions and 5 deletions

View File

@ -22,10 +22,7 @@ $(function () {
success: function (data) {
$('#bot_table_error').hide();
var bots = data.bots.sort(function (a, b) {
return b.full_name.localeCompare(a.full_name);
});
$.each(bots, function (idx, elem) {
$.each(data.bots, function (idx, elem) {
add_bot_row(elem.full_name, elem.username, elem.api_key);
});
},

View File

@ -2012,6 +2012,8 @@ def json_create_bot(request, user_profile, full_name=REQ, short_name=REQ):
def json_get_bots(request, user_profile):
bot_profiles = UserProfile.objects.filter(is_bot=True, is_active=True,
bot_owner=user_profile)
bot_profiles = bot_profiles.order_by('date_joined')
def bot_info(bot_profile):
return dict(
username = bot_profile.email,