some more stuff for blog models

This commit is contained in:
Christoph J. Scherr 2023-06-03 00:12:41 +02:00
parent ded6e7bb51
commit d6ab46f44d
Signed by: PlexSheep
GPG Key ID: 25B4ACF7D88186CC
8 changed files with 169 additions and 76 deletions

View File

@ -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
"""

View File

@ -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=''),
),
]

View File

@ -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()

View File

@ -1,87 +1,135 @@
{% load i18n %}
<div class="container-lg mt-5">
<h4 class="">{% trans "Featured" %}</h4>
<div class="row my-3">
<div class="col">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="row my-4">
<div class="card mx-3" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title<small class="text-body-secondary">sus</small></h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<div class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
<div class="card mx-3" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<div class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="card mx-3" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<div class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="card mx-3" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<div class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="row my-4">
<div class="card mx-3" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<div class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
</div>
<div class="row my-5">
<div class="col">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="card mx-3" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<div class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="card mx-3" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<div class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="card mx-3" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
{% load i18n %}
{% load helper_tags %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<nav class="sticky-top navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="{% url 'start:index' %}">
<img src="https://static.cscherr.de/images/profile/profile-margin.png" alt="Logo" height="30" class="d-inline-block align-text-top">

View File

@ -82,11 +82,6 @@
<a href="https://git.cscherr.de/PlexSheep/gawa" class="text-reset">{% trans "Quellcode dieser Website" %}</a>
</p>
</div>
<div class="col-md-3 col-lg-2 col-xl-2 mx-auto mb-4">
<h6 class="text-uppercase fw-bold mb-4">
Leer
</h6>
</div>
<div class="col-md-4 col-lg-3 col-xl-3 mx-auto mb-md-0 mb-4">
<h6 class="text-uppercase fw-bold mb-4">{% translate "Contact" %}</h6>
<p>Christoph Johannes Scherr</p>

View File

@ -2,5 +2,5 @@
<form class="d-flex" role="search" action="{% url 'start:search' %}" method="GET">
{#{ MainSearchForm }#}
<input type="search" name="search" class="form-control me-2" aria-label="Search" placeholder="Suchen" required id="id_search">
<button class="btn btn-outline-dark bg-success" type="submit">{% translate "Suchen" %}</button>
<button class="btn bg-success" type="submit">{% translate "Suchen" %}</button>
</form>

View File

@ -1,6 +1,6 @@
{% load i18n %}
{% load helper_tags %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<nav class="sticky-top navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="{% url 'start:index' %}">
<img src="https://static.cscherr.de/images/profile/profile-margin.png" alt="Logo" height="30" class="d-inline-block align-text-top">