@login_required
@no_cache
def toggle_hitgroup_status(request, id):
    hg = get_object_or_404(HitGroupContent, group_id=id)
    hg.is_public = not hg.is_public
    solr = pysolr.Solr(settings.SOLR_MAIN)
    if hg.is_public:
        # add object to solr index
        doc = _hitgroup_content_to_sorl_dt(hg)
        log.debug('adding HitGroupContent to solr index: %s', doc)
        solr.add([doc])
    else:
        # remove from solr
        log.debug('removing HitGroupContent from solr index: %s', hg.group_id)
        IndexQueue.objects.del_hitgroupcontent(hg.group_id)
        solr.delete(q='group_id:"%s"' % hg.group_id)
    hg.save()
    return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
Retrieve the record for a public folder matching a specific display name
dataset/ETHPy150Open ipeirotis/Mturk-Tracker/app/mturk/main/admin.py/toggle_hitgroup_status--crossover with--dataset/ETHPy150Open byt3bl33d3r/pth-toolkit/lib/python2.7/site-packages/openchange/mailbox.py/OpenChangeDB.lookup_public_folder