本文整理汇总了Python中arches.app.models.concept.Concept.get_time_filter_data方法的典型用法代码示例。如果您正苦于以下问题:Python Concept.get_time_filter_data方法的具体用法?Python Concept.get_time_filter_data怎么用?Python Concept.get_time_filter_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arches.app.models.concept.Concept
的用法示例。
在下文中一共展示了Concept.get_time_filter_data方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resource_manager
# 需要导入模块: from arches.app.models.concept import Concept [as 别名]
# 或者: from arches.app.models.concept.Concept import get_time_filter_data [as 别名]
def resource_manager(request, resourcetypeid='', form_id='default', resourceid=''):
if resourceid != '':
resource = Resource(resourceid)
elif resourcetypeid != '':
resource = Resource({'entitytypeid': resourcetypeid})
if form_id == 'default':
form_id = resource.form_groups[0]['forms'][0]['id']
form = resource.get_form(form_id)
if request.method == 'DELETE':
resource.delete_index()
se = SearchEngineFactory().create()
realtionships = resource.get_related_resources(return_entities=False)
for realtionship in realtionships:
se.delete(index='resource_relations', doc_type='all', id=realtionship.resourcexid)
realtionship.delete()
resource.delete()
return JSONResponse({ 'success': True })
if request.method == 'POST':
data = JSONDeserializer().deserialize(request.POST.get('formdata', {}))
form.update(data, request.FILES)
with transaction.atomic():
if resourceid != '':
resource.delete_index()
resource.save(user=request.user)
resource.index()
resourceid = resource.entityid
return redirect('resource_manager', resourcetypeid=resourcetypeid, form_id=form_id, resourceid=resourceid)
min_max_dates = models.Dates.objects.aggregate(Min('val'), Max('val'))
if request.method == 'GET':
if form != None:
lang = request.GET.get('lang', settings.LANGUAGE_CODE)
form.load(lang)
return render(request, 'resource-manager.htm', {
'form': form,
'formdata': JSONSerializer().serialize(form.data),
'form_template': 'views/forms/' + form_id + '.htm',
'form_id': form_id,
'resourcetypeid': resourcetypeid,
'resourceid': resourceid,
'main_script': 'resource-manager',
'active_page': 'ResourceManger',
'resource': resource,
'resource_name': resource.get_primary_name(),
'resource_type_name': resource.get_type_name(),
'form_groups': resource.form_groups,
'min_date': min_max_dates['val__min'].year if min_max_dates['val__min'] != None else 0,
'max_date': min_max_dates['val__max'].year if min_max_dates['val__min'] != None else 1,
'timefilterdata': JSONSerializer().serialize(Concept.get_time_filter_data()),
})
else:
return HttpResponseNotFound('<h1>Arches form not found.</h1>')
示例2: home_page
# 需要导入模块: from arches.app.models.concept import Concept [as 别名]
# 或者: from arches.app.models.concept.Concept import get_time_filter_data [as 别名]
def home_page(request):
lang = request.GET.get('lang', settings.LANGUAGE_CODE)
min_max_dates = models.Dates.objects.aggregate(Min('val'), Max('val'))
return render(request, 'search.htm', {
'main_script': 'search',
'active_page': 'Search',
'min_date': min_max_dates['val__min'].year if min_max_dates['val__min'] != None else 0,
'max_date': min_max_dates['val__max'].year if min_max_dates['val__min'] != None else 1,
'timefilterdata': JSONSerializer().serialize(Concept.get_time_filter_data()),
})
示例3: home_page
# 需要导入模块: from arches.app.models.concept import Concept [as 别名]
# 或者: from arches.app.models.concept.Concept import get_time_filter_data [as 别名]
def home_page(request):
lang = request.GET.get('lang', settings.LANGUAGE_CODE)
min_max_dates = models.Dates.objects.aggregate(Min('val'), Max('val'))
return render_to_response('search.htm', {
'main_script': 'search',
'active_page': 'Search',
'min_date': min_max_dates['val__min'].year if min_max_dates['val__min'] != None else 0,
'max_date': min_max_dates['val__max'].year if min_max_dates['val__min'] != None else 1,
'timefilterdata': JSONSerializer().serialize(Concept.get_time_filter_data()),
'group_options': settings.SEARCH_GROUP_ROOTS
},
context_instance=RequestContext(request))
示例4: home_page
# 需要导入模块: from arches.app.models.concept import Concept [as 别名]
# 或者: from arches.app.models.concept.Concept import get_time_filter_data [as 别名]
def home_page(request):
lang = request.GET.get("lang", settings.LANGUAGE_CODE)
min_max_dates = models.Dates.objects.aggregate(Min("val"), Max("val"))
return render_to_response(
"search.htm",
{
"main_script": "search",
"active_page": "Search",
"min_date": min_max_dates["val__min"].year if min_max_dates["val__min"] != None else 0,
"max_date": min_max_dates["val__max"].year if min_max_dates["val__min"] != None else 1,
"timefilterdata": JSONSerializer().serialize(Concept.get_time_filter_data()),
},
context_instance=RequestContext(request),
)
示例5: resource_manager
# 需要导入模块: from arches.app.models.concept import Concept [as 别名]
# 或者: from arches.app.models.concept.Concept import get_time_filter_data [as 别名]
def resource_manager(request, resourcetypeid='', form_id='default', resourceid=''):
## get and check all permissions here
permissions = request.user.get_all_permissions()
res_perms = {k:[] for k in settings.RESOURCE_TYPE_CONFIGS().keys()}
for k,v in res_perms.iteritems():
for p in permissions:
t,res = p.split(".")[:2]
if k.startswith(res):
v.append(t)
if resourceid == '' and not 'CREATE' in res_perms[resourcetypeid]:
return redirect(settings.LOGIN_URL)
if not 'EDIT' in res_perms[resourcetypeid]:
return redirect(settings.LOGIN_URL)
## finish permission testing
if resourceid != '':
resource = Resource(resourceid)
elif resourcetypeid != '':
resource = Resource({'entitytypeid': resourcetypeid})
if form_id == 'default':
form_id = resource.form_groups[0]['forms'][0]['id']
form = resource.get_form(form_id)
if request.method == 'DELETE':
resource.delete_index()
se = SearchEngineFactory().create()
relationships = resource.get_related_resources(return_entities=False)
for relationship in relationships:
se.delete(index='resource_relations', doc_type='all', id=relationship.resourcexid)
relationship.delete()
resource.delete()
return JSONResponse({ 'success': True })
if request.method == 'POST':
data = JSONDeserializer().deserialize(request.POST.get('formdata', {}))
form.update(data, request.FILES)
with transaction.atomic():
if resourceid != '':
resource.delete_index()
resource.save(user=request.user)
resource.index()
resourceid = resource.entityid
return redirect('resource_manager', resourcetypeid=resourcetypeid, form_id=form_id, resourceid=resourceid)
min_max_dates = models.Dates.objects.aggregate(Min('val'), Max('val'))
if request.method == 'GET':
if form != None:
lang = request.GET.get('lang', settings.LANGUAGE_CODE)
form.load(lang)
return render_to_response('resource-manager.htm', {
'form': form,
'formdata': JSONSerializer().serialize(form.data),
'form_template': 'views/forms/' + form_id + '.htm',
'form_id': form_id,
'resourcetypeid': resourcetypeid,
'resourceid': resourceid,
'main_script': 'resource-manager',
'active_page': 'ResourceManger',
'resource': resource,
'resource_name': resource.get_primary_name(),
'resource_type_name': resource.get_type_name(),
'form_groups': resource.form_groups,
'min_date': min_max_dates['val__min'].year if min_max_dates['val__min'] != None else 0,
'max_date': min_max_dates['val__max'].year if min_max_dates['val__min'] != None else 1,
'timefilterdata': JSONSerializer().serialize(Concept.get_time_filter_data()),
},
context_instance=RequestContext(request))
else:
return HttpResponseNotFound('<h1>Arches form not found.</h1>')