keyword and desc model

This commit is contained in:
DerTyp187
2021-11-24 10:25:40 +01:00
parent 36022d757c
commit 7503846d4c
4 changed files with 46 additions and 1 deletions

View File

@@ -23,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-84w$au&)%5rl8ud!82e%&)e&r+c0f9z%zlr4m9(76mebvx-r2@'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
ALLOWED_HOSTS = ['code.tealfire.de']

View File

@@ -0,0 +1,37 @@
# Generated by Django 3.2.9 on 2021-11-24 09:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='category',
name='description',
field=models.CharField(default='tag', max_length=250),
preserve_default=False,
),
migrations.AddField(
model_name='category',
name='tags',
field=models.CharField(default='e', max_length=250),
preserve_default=False,
),
migrations.AddField(
model_name='topic',
name='description',
field=models.CharField(default='ads', max_length=250),
preserve_default=False,
),
migrations.AddField(
model_name='topic',
name='tags',
field=models.CharField(default='aasd', max_length=250),
preserve_default=False,
),
]

View File

@@ -5,6 +5,8 @@ class Category(models.Model):
title = models.CharField(max_length=100, unique=True)
display_name = models.CharField(max_length= 100)
date_created = models.DateTimeField(default=timezone.now)
tags = models.CharField(max_length=250)
description = models.CharField(max_length=250)
def __str__(self):
return self.title
@@ -18,6 +20,8 @@ class Topic(models.Model):
category = models.ForeignKey(Category, on_delete=models.CASCADE)
version = models.CharField(max_length=100, blank=True)
read_more = models.TextField(blank=True)
tags = models.CharField(max_length=250)
description = models.CharField(max_length=250)
def __str__(self):
return self.category.title + " - " + self.title

View File

@@ -36,6 +36,8 @@ def topic(req, category, topic):
'helpful_count': helpful_count,
'notHelpful_count': notHelpful_count,
'read_more': topic_obj.read_more,
'keywords': topic_obj.tags,
'description': topic_obj.description,
}
return render(req, "main/topic.html", context)
@@ -55,6 +57,8 @@ def category(req, category):
'topics': topics_obj,
'current': category_obj.title,
'title': category_obj.display_name,
'keywords': category_obj.tags,
'description': category_obj.description,
}
return render(req, "main/category.html", context)