-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #562 from memeLab/add_blog
Add blog to Jandig
- Loading branch information
Showing
29 changed files
with
1,611 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: '3.8' | ||
|
||
services: | ||
django: | ||
build: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from blog.models import Category, Clipping, Post, PostImage | ||
from django.contrib import admin | ||
|
||
admin.site.register(Category) | ||
admin.site.register(PostImage) | ||
admin.site.register(Clipping) | ||
|
||
|
||
@admin.register(Post) | ||
class PostAdmin(admin.ModelAdmin): | ||
list_display = ("title", "status", "created", "updated") | ||
raw_id_fields = ("author",) | ||
|
||
def get_queryset(self, request): | ||
return super().get_queryset(request).select_related("author") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% extends "blog/index.jinja2" %} | ||
|
||
{% block page_title %} | ||
<h2>{{ category }}</h2> | ||
{% endblock page_title %} | ||
|
||
{%block button%} | ||
<a id="back-button" href="{{ url('blog_index') }}">{{ _('< Back to Blog') }}</a> | ||
<br /> | ||
{%endblock%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% extends '/core/home.jinja2' %} | ||
|
||
{% block extra_css %} | ||
<link rel="stylesheet" href="{{ static('css/blog.css') }}"> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div id="blog-area"> | ||
{% block button %} | ||
{% endblock %} | ||
{% block page_title %} | ||
<h2>{{ _("Clippings") }}</h2> | ||
{% endblock page_title %} | ||
{% for clipping in clippings %} | ||
<div class="post"> | ||
<h3>{{ clipping.title }}</h3> | ||
<p>{{ clipping.created.date() }} </p> | ||
<p>{{ clipping.description }}</p> | ||
<a href="{{ clipping.link }}">{{ clipping.link }}</a> | ||
<br /> | ||
<br /> | ||
<a href="{{ clipping.file.url }}">{{ _("Download File")}}</a> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% extends "blog/index.jinja2" %} | ||
|
||
{% block content %} | ||
<div id="post-area"> | ||
<a id="back-button" href="{{ url('blog_index') }}">{{ _('< Back to Blog') }}</a> | ||
<br /> | ||
{% block page_title %} | ||
<h2>{{ post.title }}</h2> | ||
{% endblock page_title %} | ||
<small> | ||
{{ post.created.date() }} | ||
{% if post.categories.count() > 0 %} | ||
| {{ _("Categories:") }} | ||
{% for category in post.categories.all() %} | ||
<a href="{{ url('blog_category',args=[category.name])}}"> | ||
{{ category.name }} | ||
</a> | ||
{% endfor %} | ||
{% endif%} | ||
</small> | ||
<div id=post> | ||
<p>{{ post.body |safe }}</p> | ||
{% for image in images %} | ||
<div class="post-image"> | ||
<img class="post-image" src="{{ image.file.url }}" /> | ||
{% if image.description %} | ||
<h5>{{ image.description }}</h5> | ||
{% endif %} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
|
||
</div> | ||
<br /> | ||
<a href="#" id="back-to-top"> {{_("Back to Top")}}</a> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{% extends '/core/home.jinja2' %} | ||
|
||
{% block extra_css %} | ||
<link rel="stylesheet" href="{{ static('css/blog.css') }}"> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div id="blog-area"> | ||
{% block button %} | ||
{% endblock %} | ||
{% block page_title %} | ||
<h2>{{ _("Blog Posts") }}</h2> | ||
{% endblock page_title %} | ||
<div id="category-header"> | ||
<small> | ||
{{_("Categories:")}} | ||
{% for category in blog_categories %} | ||
<a href="{{ url('blog_category',args=[category.name])}}"> | ||
{{ category.name }} | ||
</a> | ||
{% endfor %} | ||
</small> | ||
</div> | ||
<div id="posts-area"> | ||
{% include "/blog/post_preview.jinja2" %} | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% for post in posts %} | ||
<div class="post"> | ||
<h3><a href="{{ url('blog_detail', args=[post.pk])}}">{{ post.title }}</a></h3> | ||
<small> | ||
{{ post.created.date() }} | ||
{% if post.categories.count() > 0 %} | ||
| {{ _("Categories:") }} | ||
{% for category in post.categories.all() %} | ||
<a href="{{ url('blog_category', args=[category.name])}}"> | ||
{{ category.name }} | ||
</a> | ||
{% endfor %} | ||
{% endif%} | ||
</small> | ||
<p>{{ post.body[:PREVIEW_SIZE] | safe }}... <a href="{{ url('blog_detail', args=[post.pk])}}">{{ _("Read More") }}</a></p> | ||
</div> | ||
{% endfor %} | ||
{% if posts.count() == page_size %} | ||
<button hx-get="{{ page_url }}?page={{ next_page_number }}" hx-trigger="click" hx-swap="outerHTML"> {{_("See more")}}</button> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Generated by Django 4.1.5 on 2024-06-23 17:41 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
("users", "0009_alter_profile_id"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Category", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("name", models.CharField(max_length=100)), | ||
], | ||
options={ | ||
"verbose_name_plural": "categories", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="PostImage", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("file", models.FileField()), | ||
( | ||
"description", | ||
models.CharField(blank=True, max_length=500, null=True), | ||
), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="Post", | ||
fields=[ | ||
("id", models.BigAutoField(primary_key=True, serialize=False)), | ||
("title", models.CharField(max_length=200)), | ||
( | ||
"status", | ||
models.CharField( | ||
choices=[("draft", "Draft"), ("published", "Published")], | ||
default="draft", | ||
max_length=20, | ||
), | ||
), | ||
("body", models.TextField()), | ||
("created", models.DateTimeField()), | ||
("updated", models.DateTimeField(auto_now=True)), | ||
( | ||
"author", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="posts", | ||
to="users.profile", | ||
), | ||
), | ||
( | ||
"categories", | ||
models.ManyToManyField( | ||
blank=True, related_name="posts", to="blog.category" | ||
), | ||
), | ||
( | ||
"images", | ||
models.ManyToManyField( | ||
blank=True, related_name="posts", to="blog.postimage" | ||
), | ||
), | ||
], | ||
), | ||
] |
Oops, something went wrong.