|
@ -1,15 +1,23 @@ |
|
|
from django.http import HttpResponse |
|
|
from django.http import HttpResponse |
|
|
from django.shortcuts import render |
|
|
from django.shortcuts import render |
|
|
|
|
|
|
|
|
from sapl.crud.base import CrudAux |
|
|
from sapl.crud.base import CrudAux, Crud |
|
|
from sapl.lexml.OAIServer import OAIServerFactory, get_config |
|
|
from sapl.lexml.OAIServer import OAIServerFactory, get_config |
|
|
|
|
|
from sapl.rules import RP_DETAIL, RP_LIST |
|
|
|
|
|
|
|
|
from .models import LexmlProvedor, LexmlPublicador |
|
|
from .models import LexmlProvedor, LexmlPublicador |
|
|
|
|
|
|
|
|
LexmlProvedorCrud = CrudAux.build(LexmlProvedor, 'lexml_provedor') |
|
|
|
|
|
LexmlPublicadorCrud = CrudAux.build(LexmlPublicador, 'lexml_publicador') |
|
|
LexmlPublicadorCrud = CrudAux.build(LexmlPublicador, 'lexml_publicador') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LexmlProvedorCrud(Crud): |
|
|
|
|
|
model = LexmlProvedor |
|
|
|
|
|
help_topic = 'lexml_provedor' |
|
|
|
|
|
public = [RP_LIST, RP_DETAIL] |
|
|
|
|
|
|
|
|
|
|
|
class DetailView(Crud.DetailView): |
|
|
|
|
|
layout_key = 'LexmlProvedorDetail' |
|
|
|
|
|
|
|
|
def lexml_request(request): |
|
|
def lexml_request(request): |
|
|
config = get_config(request.get_raw_uri(), int(request.GET.get('batch_size', '10'))) |
|
|
config = get_config(request.get_raw_uri(), int(request.GET.get('batch_size', '10'))) |
|
|
oai_server = OAIServerFactory(config) |
|
|
oai_server = OAIServerFactory(config) |
|
@ -17,5 +25,6 @@ def lexml_request(request): |
|
|
response = r.decode('UTF-8') |
|
|
response = r.decode('UTF-8') |
|
|
return HttpResponse(response, content_type='text/xml') |
|
|
return HttpResponse(response, content_type='text/xml') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def request_search(request, keyword): |
|
|
def request_search(request, keyword): |
|
|
return render(request,"lexml/resultado-pesquisa.html",{"keyword":keyword}) |
|
|
return render(request, "lexml/resultado-pesquisa.html", {"keyword":keyword}) |
|
|