本文整理汇总了Python中invenio_deposit.models.Deposition.get_depositions方法的典型用法代码示例。如果您正苦于以下问题:Python Deposition.get_depositions方法的具体用法?Python Deposition.get_depositions怎么用?Python Deposition.get_depositions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio_deposit.models.Deposition
的用法示例。
在下文中一共展示了Deposition.get_depositions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: halt_to_render
# 需要导入模块: from invenio_deposit.models import Deposition [as 别名]
# 或者: from invenio_deposit.models.Deposition import get_depositions [as 别名]
def halt_to_render(obj, eng):
"""Halt the workflow - waiting to be resumed."""
deposition = Deposition(obj)
sip = deposition.get_latest_sip(sealed=False)
deposition.set_render_context(dict(
template_name_or_list="deposit/completed.html",
deposition=deposition,
deposition_type=(
None if deposition.type.is_default() else
deposition.type.get_identifier()
),
uuid=deposition.id,
sip=sip,
my_depositions=Deposition.get_depositions(
current_user, type=deposition.type
),
format_record=format_record,
))
obj.last_task = "halt_to_render"
eng.halt("User submission complete.")
示例2: show_stats
# 需要导入模块: from invenio_deposit.models import Deposition [as 别名]
# 或者: from invenio_deposit.models.Deposition import get_depositions [as 别名]
def show_stats(deposition_type):
"""Render the stats for all the depositions."""
if len(DepositionType.keys()) <= 1 and \
DepositionType.get_default() is not None:
abort(404)
form = FilterDateForm()
deptype = DepositionType.get(deposition_type)
submitted_depositions = [d for d in Deposition.get_depositions(type=deptype) if d.has_sip(sealed=True)]
ctx = process_metadata_for_charts(submitted_depositions,
group_by=request.args.get('group_by', 'type_of_doc'))
ctx.update(dict(
deposition_type=deptype,
depositions=submitted_depositions,
form=form,
chart_types=CHART_TYPES
))
return render_template('deposit/stats/all_depositions.html', **ctx)
示例3: stats_api
# 需要导入模块: from invenio_deposit.models import Deposition [as 别名]
# 或者: from invenio_deposit.models.Deposition import get_depositions [as 别名]
def stats_api(deposition_type):
"""Get stats JSON."""
deptype = DepositionType.get(deposition_type)
submitted_depositions = [d for d in Deposition.get_depositions(type=deptype) if d.has_sip(sealed=True)]
if request.args.get('since_date') is not None:
since_date = datetime.strptime(request.args['since_date'],
"%Y-%m-%d").replace(hour=0, minute=0)
submitted_depositions = [d for d in submitted_depositions if d.created >= since_date]
if request.args.get('until_date') is not None:
until_date = datetime.strptime(request.args['until_date'],
"%Y-%m-%d").replace(hour=23, minute=59)
submitted_depositions = [d for d in submitted_depositions if d.created <= until_date]
result = process_metadata_for_charts(submitted_depositions,
request.args.get('group_by', 'type_of_doc'),
bool(request.args.get('include_hidden', None)))
resp = jsonify(result)
return resp