diff --git a/gawa/blog/migrations/0002_auto_20230602_1200.py b/gawa/blog/migrations/0002_auto_20230602_1200.py new file mode 100644 index 0000000..c663795 --- /dev/null +++ b/gawa/blog/migrations/0002_auto_20230602_1200.py @@ -0,0 +1,36 @@ +# Generated by Django 3.2.19 on 2023-06-02 10:00 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('start', '0002_auto_20230531_2254'), + ('blog', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Category', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=50)), + ('subtitle', models.CharField(max_length=50)), + ('desc', models.CharField(max_length=250, unique=True)), + ('date', models.DateField(blank=True)), + ('name', models.CharField(max_length=50)), + ('slug', models.SlugField()), + ('keywords', models.ManyToManyField(to='start.Keyword')), + ], + options={ + 'abstract': False, + }, + ), + migrations.AddField( + model_name='blogpost', + name='category', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='blog.category'), + ), + ] diff --git a/gawa/blog/models.py b/gawa/blog/models.py index b0de991..66912a9 100644 --- a/gawa/blog/models.py +++ b/gawa/blog/models.py @@ -2,6 +2,13 @@ from django.db import models from start.models import AbstractSearchable +class Category(AbstractSearchable): + """ + A category of blog posts + """ + name = models.CharField(max_length=50) + slug = models.SlugField() + class BlogPost(AbstractSearchable): """ Should contain a blogpost @@ -11,4 +18,5 @@ class BlogPost(AbstractSearchable): desc = models.CharField(max_length=250, unique=True) body = models.TextField() date = models.DateField(blank=True) + category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True) slug = models.SlugField() diff --git a/gawa/blog/templates/blog/index.html b/gawa/blog/templates/blog/index.html index a6c6226..1cb92bd 100644 --- a/gawa/blog/templates/blog/index.html +++ b/gawa/blog/templates/blog/index.html @@ -1 +1,41 @@ -not implemented +{% extends 'start/base.html' %} +{% load i18n %} +{% get_current_language as LANGUAGE_CODE %} +{% block languagecode %}{{ LANGUAGE_CODE }}{% endblock languagecode %} +{% block title %}{% translate "cscherr.de" %} - {% translate "Blog" %}{% endblock title %} +{% block main %} +
{% translate "Blog" %}
++ {% blocktranslate %} + Whenever I discover some interesting security thing, I will post a writeup here. + {% endblocktranslate %} +
++ + + +
+ +
+ Sleek, intuitive, and powerful front-end framework for faster and easier web development.
+
+ Explore Bootstrap docs »
+
+
+ Report bug
+ ·
+ Request feature
+ ·
+ Themes
+ ·
+ Blog
+