Hi everyone,

I have a view to do some re-ordering of a list via ajax:

@staff_member_required
def reorder(request):
    collections = Collection.objects.all()

    if request.method == 'POST':
        pk_ids = request.POST['pk_ids'].split(',')
        length = len(pk_ids)

        for collection in collections:
            for i in xrange(length):
                id = pk_ids[i]
                if str(collection.id) == str(id):
                    collection.position = (i + 1)
                    collection.save()

        return render_to_response('empty.html')
    else:
        return render_to_response('admin/portfolio/collection/
reorder.html', {'collections' : collections})


When I call "reorder" via ajax and post data, Django complains if I
don't return an HttpResponse object. So, I've just been returning an
empty html file. Is there a more elegant way to handle this?

TIA,
Brandon
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to