Skip to content

Commit

Permalink
json for rpc result and error
Browse files Browse the repository at this point in the history
  • Loading branch information
pat1 committed Jan 16, 2024
1 parent b7576b6 commit 913e38c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion python/rpc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ class Rpc(models.Model):

def params_json(self):
return json.dumps(self.params)


def result_json(self):
return json.dumps(self.result)

def error_json(self):
if self.error is None:
return _("OK")
return json.dumps(self.error)

def status(self):
if (self.datecmd is not None):
if (self.dateres is not None):
Expand Down
4 changes: 2 additions & 2 deletions python/rpc/templates/rpc/rpc_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ <h4>{% trans 'Station:' %} <a href="{% url 'rpcs-list' myrpc.stationmetadata.use
<td>{% trans 'Response' %}</td>
<td></td>
<td></td>
<td>{{ myrpc.result }}</td>
<td>{{ myrpc.error }}</td>
<td>{{ myrpc.result_json }}</td>
<td>{{ myrpc.error_json }}</td>
</tr>

</table>
Expand Down

0 comments on commit 913e38c

Please sign in to comment.