Kaydet (Commit) 7ee354f0 authored tarafından Batuhan Taşkaya's avatar Batuhan Taşkaya

evality, as_html renderer

üst 7640bc0d
...@@ -14,7 +14,7 @@ django-simple-captcha = "*" ...@@ -14,7 +14,7 @@ django-simple-captcha = "*"
gunicorn = "*" gunicorn = "*"
whitenoise = "*" whitenoise = "*"
docker = "*" docker = "*"
evality = "==0.1.2" evality = "==0.2.1"
[scripts] [scripts]
start = "gunicorn aspava.wsgi:application --bind localhost:8000" start = "gunicorn aspava.wsgi:application --bind localhost:8000"
......
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "f81289205e0d2d872d2676bf4620fafa2a85458a7ab4e456b3d92d0775bc2f2b" "sha256": "f7d5f6bc4fbca2893bd56d1a4941e33a77186a659547c40ffcc69188771f1deb"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
...@@ -83,10 +83,10 @@ ...@@ -83,10 +83,10 @@
}, },
"evality": { "evality": {
"hashes": [ "hashes": [
"sha256:bc01b97d1b31c78225dd9019f4ccc1b5cca591dad6a5b384eb24ef8f50777d9b" "sha256:6a95d16b6a08b73278e8e8daedcacaf032b6da4d11fd5c5622b885b318a332a9"
], ],
"index": "pypi", "index": "pypi",
"version": "==0.1.2" "version": "==0.2.1"
}, },
"gunicorn": { "gunicorn": {
"hashes": [ "hashes": [
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="container-fluid __{{ item | get_class }}"> <div class="container-fluid __{{ item | get_class }}">
<fieldset class="border p-2"> <fieldset class="border p-2">
<legend class="w-auto"><a href="{% url 'profile' item.author %}">{{ item.author }}</a></legend> <legend class="w-auto"><a href="{% url 'profile' item.author %}">{{ item.author }}</a></legend>
{% as_html item %} {% as_html item user %}
<small class="text-muted">{{ item.pub_date }}</small> <small class="text-muted">{{ item.pub_date }}</small>
{% if item.author == request.user %} {% if item.author == request.user %}
<small class="text-muted"><a href="{% get_opt 'delete' item %}">delete</a></small> <small class="text-muted"><a href="{% get_opt 'delete' item %}">delete</a></small>
......
...@@ -19,9 +19,9 @@ def get_class(item): ...@@ -19,9 +19,9 @@ def get_class(item):
@register.simple_tag @register.simple_tag
def as_html(item): def as_html(item, user):
result = render_to_string( result = render_to_string(
f"repr/{item.__class__.__name__.lower()}.html", {"item": item} f"repr/{item.__class__.__name__.lower()}.html", {"item": item, "user": user}
) )
return result return result
......
...@@ -29,7 +29,7 @@ def run_snippet(request): ...@@ -29,7 +29,7 @@ def run_snippet(request):
global evality global evality
try: try:
result = evality.run_cmd(snippet.text, snippet.author.id) result = evality.run_cmd(snippet.text, snippet.author.id)
except docker.DockerException: except docker.exceptions.DockerException:
evality.quit() evality.quit()
result['id'] = snippet.id result['id'] = snippet.id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment