コード例 #1
0
ファイル: views.py プロジェクト: erimille/recollection
    def get(self, request, *args, **kwargs):
        uuid = kwargs["uuid"]
        source = get_object_or_404(models.DataSource, uuid=uuid)
        if not self.request.user.has_perm("datasource.can_edit", source):
            raise Http404

        tx = source.open_transaction()
        if tx.is_complete:
            raise Http404

        status = pretty_print_transaction_status(tx.status)

        return JSONResponse({"status": unicode(status), "isReady": tx.is_ready()})
コード例 #2
0
def datasource_transaction_list_item(context, datasource_transaction):
    """
    Display details for a DataSourceTransaction model
    """
    transaction_url = datasource_transaction.get_absolute_url()
    transaction_result_url = reverse(
            'datasource_transaction_status',
            kwargs={'tx_id': datasource_transaction.tx_id})
    status = pretty_print_transaction_status(datasource_transaction.status)

    return {'datasource_transaction': datasource_transaction,
            'datasource_transaction_url': transaction_url,
            'datasource_transaction_result_url': transaction_result_url,
            'status': status}