From d6ab46f44df85dd905b74a59df6cd44595db8445 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sat, 3 Jun 2023 00:12:41 +0200 Subject: [PATCH] some more stuff for blog models --- gawa/blog/admin.py | 13 +- .../migrations/0003_auto_20230603_0009.py | 38 ++++ gawa/blog/models.py | 3 +- gawa/blog/templates/blog/featured.html | 180 +++++++++++------- gawa/blog/templates/blog/nav.html | 2 +- gawa/start/templates/base.html | 5 - gawa/start/templates/main_search_form.html | 2 +- gawa/start/templates/start/nav.html | 2 +- 8 files changed, 169 insertions(+), 76 deletions(-) create mode 100644 gawa/blog/migrations/0003_auto_20230603_0009.py diff --git a/gawa/blog/admin.py b/gawa/blog/admin.py index 8c38f3f..96fe54e 100644 --- a/gawa/blog/admin.py +++ b/gawa/blog/admin.py @@ -1,3 +1,14 @@ from django.contrib import admin +from .models import * -# Register your models here. +@admin.register(Category) +class CategoryAdmin(admin.ModelAdmin): + """ + The admin model for Category + """ + +@admin.register(BlogPost) +class BlogPostAdmin(admin.ModelAdmin): + """ + The admin model for BlogPost + """ diff --git a/gawa/blog/migrations/0003_auto_20230603_0009.py b/gawa/blog/migrations/0003_auto_20230603_0009.py new file mode 100644 index 0000000..f97b688 --- /dev/null +++ b/gawa/blog/migrations/0003_auto_20230603_0009.py @@ -0,0 +1,38 @@ +# Generated by Django 3.2.19 on 2023-06-02 22:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0002_auto_20230602_1200'), + ] + + operations = [ + migrations.RemoveField( + model_name='category', + name='date', + ), + migrations.RemoveField( + model_name='category', + name='desc', + ), + migrations.RemoveField( + model_name='category', + name='keywords', + ), + migrations.RemoveField( + model_name='category', + name='subtitle', + ), + migrations.RemoveField( + model_name='category', + name='title', + ), + migrations.AddField( + model_name='blogpost', + name='thumbnail', + field=models.ImageField(blank=True, upload_to=''), + ), + ] diff --git a/gawa/blog/models.py b/gawa/blog/models.py index 66912a9..5cf0ab3 100644 --- a/gawa/blog/models.py +++ b/gawa/blog/models.py @@ -2,7 +2,7 @@ from django.db import models from start.models import AbstractSearchable -class Category(AbstractSearchable): +class Category(models.Model): """ A category of blog posts """ @@ -19,4 +19,5 @@ class BlogPost(AbstractSearchable): body = models.TextField() date = models.DateField(blank=True) category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True) + thumbnail = models.ImageField(blank=True) slug = models.SlugField() diff --git a/gawa/blog/templates/blog/featured.html b/gawa/blog/templates/blog/featured.html index 2437058..f3de44c 100644 --- a/gawa/blog/templates/blog/featured.html +++ b/gawa/blog/templates/blog/featured.html @@ -1,87 +1,135 @@ {% load i18n %}

{% trans "Featured" %}

-
-
-
- ... -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere -
+
+
+ ... +
+
Card titlesus
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • An item
  • +
  • A second item
  • +
  • A third item
  • +
+
-
-
- ... -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere -
+
+ ... +
+
Card title
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • An item
  • +
  • A second item
  • +
  • A third item
  • +
+
-
-
- ... -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere -
+
+ ... +
+
Card title
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • An item
  • +
  • A second item
  • +
  • A third item
  • +
+
-
-
- ... -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere -
+
+ ... +
+
Card title
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • An item
  • +
  • A second item
  • +
  • A third item
  • +
+
-
-
-
- ... -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere -
+
+
+ ... +
+
Card title
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • An item
  • +
  • A second item
  • +
  • A third item
  • +
+
-
-
- ... -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere -
+
+ ... +
+
Card title
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • An item
  • +
  • A second item
  • +
  • A third item
  • +
+
-
-
- ... -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere -
+
+ ... +
+
Card title
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • An item
  • +
  • A second item
  • +
  • A third item
  • +
+
-
-
- ... -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere -
+
+ ... +
+
Card title
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • An item
  • +
  • A second item
  • +
  • A third item
  • +
+
diff --git a/gawa/blog/templates/blog/nav.html b/gawa/blog/templates/blog/nav.html index d817b2f..3830285 100644 --- a/gawa/blog/templates/blog/nav.html +++ b/gawa/blog/templates/blog/nav.html @@ -1,6 +1,6 @@ {% load i18n %} {% load helper_tags %} -