categories

This commit is contained in:
2020-06-07 09:37:05 +00:00
parent 5d46a71f5b
commit 63a7f1f6de
2 changed files with 12 additions and 4 deletions

View File

@@ -1,8 +1,11 @@
from django.contrib import admin
from .models import Post, Event
from .models import Post, Event, Category
# Register your models here.
from .forms import MyPostForm
class MyCategoryAdmin(admin.ModelAdmin):
model = Category
admin.site.register(Category,MyCategoryAdmin)
class MyPostAdmin(admin.ModelAdmin):
form = MyPostForm
model = Post

View File

@@ -14,6 +14,7 @@ from django.db.models import Q
class PostManager(models.Manager):
def get_queryset(self):
return super().get_queryset()
class NewsPostManager(models.Manager):
"""
Provide a query set only for "News"
@@ -27,9 +28,13 @@ class EventManager(models.Manager):
return super().get_queryset().filter(Q(is_event=True))
class Category(models.Model):
title =models.CharField(max_length=200) # Titel des Posts
subtitle = models.CharField(max_length=500, null=True, blank=True) # subtitle
slug = models.SlugField(unique=True,null=True,blank=True) # Slug = Text Basierter url bestandteil zb Fetsitzung 22.1.2020 --> fetsitzung_22_1_2020 für Url
image = models.ImageField(null=True,blank=True) # Ein Haupt Bild für den Post
tags = TaggableManager(blank=True) # Tags
# Create your models here.
class Post(models.Model):
# id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)