def api_current(request): snapshot = public_snapshot() data = dict() filename_base = snapshot.dump_filename_base() data['json_url'] = settings.MEDIA_URL + "dumps/" + filename_base + ".json" data['zip_url'] = settings.MEDIA_URL + "dumps/" + filename_base + ".zip" json = dumps(data) return HttpResponse(json, content_type="application/json")
def search(request): q = request.GET.get('q', '') if q == '': return HttpResponseRedirect("/") snapshot = public_snapshot() charges = Charge.objects.filter( snapshot=snapshot, label__icontains=q) | Charge.objects.filter(snapshot=snapshot, penal_code__icontains=q) charges = [c for c in charges if c.is_leaf()] return render(request, 'law/search.html', dict(charges=charges))
def snapshot(self): return public_snapshot()
def get_context_data(self, **kwargs): snapshot = public_snapshot() return dict(charges=snapshot.top_level_charges())
def get_context_data(self, *args, **kwargs): return dict(snapshots=Snapshot.objects.all(), working_snapshot=working_snapshot(), public_snapshot=public_snapshot())