basic app structure setup

This commit is contained in:
CDaut 2022-05-29 18:34:20 +02:00 committed by CDaut
parent 22b616082b
commit be4123361f
11 changed files with 60 additions and 0 deletions

View file

View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class BlogConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'blog'

View file

View file

@ -0,0 +1,19 @@
from django.db import models
class Tag(models.Model):
name = models.CharField(max_length=255)
class Topic(models.Model):
name = models.CharField(max_length=255)
numbered = models.BooleanField(default=False)
rootTopic = models.ForeignKey('self', blank=True, on_delete=models.CASCADE)
class Blogpost(models.Model):
created = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
title = models.CharField(max_length=255)
tags = models.ManyToManyField(Tag)
topics = models.ForeignKey(Topic, blank=True, on_delete=models.CASCADE)

View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View file

@ -0,0 +1,7 @@
from blog.views import viewblog, addpost
from django.urls import path
urlpatterns = [
path('', viewblog),
path('manage/add/', addpost),
]

View file

@ -0,0 +1,10 @@
from django.shortcuts import render
# Create your views here.
def viewblog(request):
return None
def addpost(request):
return render(request, 'blog/addpost.html')

View file

@ -32,6 +32,7 @@ ALLOWED_HOSTS = []
INSTALLED_APPS = [
'login',
'blog',
'markdownblog',
'django.contrib.admin',
'django.contrib.auth',

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View file

@ -2,6 +2,7 @@ from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('blog.urls')),
path('admin/', admin.site.urls),
path('auth/', include('login.urls')),
]