Skip to content

Commit

Permalink
Add a simple blog
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosribas committed Nov 13, 2023
1 parent ade09fc commit 4cfdcb9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
"corsheaders",
"django_filters",
"drf_spectacular",
"tinymce",
]

PROJECT_APPS = ("sequence",)
PROJECT_APPS = ("blog", "sequence",)

INSTALLED_APPS += PROJECT_APPS

Expand Down
3 changes: 2 additions & 1 deletion backend/backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import include, path
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView

from sequence.api.accession.viewsets import AccessionViewSet
Expand All @@ -37,6 +37,7 @@

urlpatterns = [
path("admin/", admin.site.urls),
path('tinymce/', include("tinymce.urls")),
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
path("api/swagger/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
Expand Down
Empty file added backend/blog/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions backend/blog/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.contrib import admin
from .models import Article

admin.site.register(Article)
6 changes: 6 additions & 0 deletions backend/blog/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BlogConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "blog"
16 changes: 16 additions & 0 deletions backend/blog/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.db import models
from tinymce.models import HTMLField


class Article(models.Model):
title = models.CharField(max_length=1000)
content = HTMLField()
created = models.DateField(auto_now_add=True)
featured = models.BooleanField(default=False)

class Meta:
db_table = "blog"
ordering = ["created"]

def __str__(self):
return self.title

0 comments on commit 4cfdcb9

Please sign in to comment.