mirror of
https://github.com/DerTyp7/tealcode-django-python.git
synced 2025-10-30 04:47:09 +01:00
output field
This commit is contained in:
19
TealCode/main/migrations/0007_topic_output.py
Normal file
19
TealCode/main/migrations/0007_topic_output.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 3.2.9 on 2021-11-13 15:29
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0006_auto_20211112_0855'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='topic',
|
||||||
|
name='output',
|
||||||
|
field=models.TextField(default='test'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
||||||
18
TealCode/main/migrations/0008_alter_topic_output.py
Normal file
18
TealCode/main/migrations/0008_alter_topic_output.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.2.9 on 2021-11-13 15:30
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0007_topic_output'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='topic',
|
||||||
|
name='output',
|
||||||
|
field=models.TextField(blank=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -14,6 +14,7 @@ class Category(models.Model):
|
|||||||
class Topic(models.Model):
|
class Topic(models.Model):
|
||||||
title = models.CharField(max_length=200)
|
title = models.CharField(max_length=200)
|
||||||
code_text = models.TextField()
|
code_text = models.TextField()
|
||||||
|
output = models.TextField(blank=True)
|
||||||
date_created = models.DateTimeField(default=timezone.now)
|
date_created = models.DateTimeField(default=timezone.now)
|
||||||
category = models.ForeignKey(Category, on_delete=models.CASCADE)
|
category = models.ForeignKey(Category, on_delete=models.CASCADE)
|
||||||
version = models.CharField(max_length=100, blank=True)
|
version = models.CharField(max_length=100, blank=True)
|
||||||
|
|||||||
@@ -28,10 +28,14 @@
|
|||||||
<div id="main-content-code">
|
<div id="main-content-code">
|
||||||
|
|
||||||
<pre><code style="padding-top: 5px; padding-bottom: 5px;"class="language-{{category_title}}">{{code}}</code></pre>
|
<pre><code style="padding-top: 5px; padding-bottom: 5px;"class="language-{{category_title}}">{{code}}</code></pre>
|
||||||
|
{% if output %}
|
||||||
|
<br>
|
||||||
|
<pre><code style="padding-top: 5px; padding-bottom: 5px;"class="language-python">#Output: {{output}}</code></pre>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if version %}
|
{% if version %}
|
||||||
<div class="note">
|
<div class="note">
|
||||||
<p>{{version}}</p>
|
<p>Tested in version: {{version}}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ def topic(req, category, topic):
|
|||||||
'version': topic_obj.version,
|
'version': topic_obj.version,
|
||||||
'previous': previous_obj,
|
'previous': previous_obj,
|
||||||
'next': next_obj,
|
'next': next_obj,
|
||||||
|
'output': topic_obj.output,
|
||||||
}
|
}
|
||||||
|
|
||||||
return render(req, "main/topic.html", context)
|
return render(req, "main/topic.html", context)
|
||||||
|
|||||||
Reference in New Issue
Block a user