Skip to content

Commit

Permalink
Merge pull request #6 from AdmiralHonda/v1.11
Browse files Browse the repository at this point in the history
V1.11
  • Loading branch information
AdmiralHonda authored Mar 9, 2021
2 parents 5c465b9 + b24d59e commit 814b32e
Show file tree
Hide file tree
Showing 20 changed files with 572 additions and 374 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.vscode
mysiteandship-3e1fa5ac8c78.json
./IizakaEmpire/sercrets
mysiteandship-1f606245abce.json
IizakaEmpire/sercrets.py
back.txt
11 changes: 6 additions & 5 deletions IizakaEmpire/IizakaEmpire/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@
'django_cleanup',#for rm image
'django.contrib.sites',#for sitemap←if you manage single site,this app cause error 'Does't exist /admin/login'
'django.contrib.sitemaps',#for sitemap
'rest_framework',
'silk'
]

SITE_ID = 3

MIDDLEWARE = [
'compression_middleware.middleware.CompressionMiddleware',
'silk.middleware.SilkyMiddleware',
'django.middleware.gzip.GZipMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
Expand All @@ -64,7 +67,6 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand Down Expand Up @@ -137,6 +139,5 @@
from google.oauth2 import service_account

GS_CREDENTIALS = service_account.Credentials.from_service_account_file(
os.path.join(BASE_DIR,'mysiteandship-3e1fa5ac8c78.json')
)

os.path.join(BASE_DIR,'mysiteandship-1f606245abce.json')
)
6 changes: 6 additions & 0 deletions IizakaEmpire/IizakaEmpire/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from django.contrib.sitemaps.views import sitemap
from .sitemaps import MyBlogSitemap,StaticSitemap
from django.views.generic import TemplateView

from MyBlog.urls import router

sitemaps={
'blog':MyBlogSitemap,
'static':StaticSitemap,
Expand All @@ -32,8 +35,11 @@
path('sitemap.xml',sitemap,{'sitemaps' : sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
path('robots.txt',TemplateView.as_view(template_name="robots.txt", content_type="text/plain")),
path('ads.txt',TemplateView.as_view(template_name="ads.txt", content_type="text/plain")),
path('api/', include(router.urls)),
]

urlpatterns += [path('silk/', include('silk.urls', namespace='silk'))]

if settings.DEBUG:
urlpatterns+=static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
urlpatterns+=static(settings.STATIC_URL,document_root=settings.STATIC_ROOT)
3 changes: 2 additions & 1 deletion IizakaEmpire/MyBlog/admin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from django.contrib import admin
from .models import Article,Category,Tag,Author,Policy
from .models import Article, Kinds, Category, Tag, Author, Policy
from markdownx.admin import MarkdownxModelAdmin
# Register your models here.
admin.site.register(Article,MarkdownxModelAdmin)
admin.site.register(Category)
admin.site.register(Kinds)
admin.site.register(Tag)
admin.site.register(Author)
admin.site.register(Policy)
19 changes: 19 additions & 0 deletions IizakaEmpire/MyBlog/migrations/0010_auto_20201101_1721.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.1.2 on 2020-11-01 08:21

from django.db import migrations
import markdownx.models


class Migration(migrations.Migration):

dependencies = [
('MyBlog', '0009_auto_20200422_2143'),
]

operations = [
migrations.AlterField(
model_name='article',
name='contents',
field=markdownx.models.MarkdownxField(help_text='box9 is note box<div>\n outline is list <ul class="outline"><li><h4></h4></li></ul>', verbose_name='Contents'),
),
]
37 changes: 37 additions & 0 deletions IizakaEmpire/MyBlog/migrations/0011_auto_20201129_2320.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 3.1.2 on 2020-11-29 14:20

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('MyBlog', '0010_auto_20201101_1721'),
]

operations = [
migrations.CreateModel(
name='Kinds',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=8)),
('slug', models.SlugField(max_length=16, unique=True)),
],
),
migrations.AlterField(
model_name='article',
name='meta_description',
field=models.CharField(max_length=128),
),
migrations.AlterField(
model_name='article',
name='slug',
field=models.SlugField(max_length=32, unique=True),
),
migrations.AddField(
model_name='tag',
name='kind',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='MyBlog.kinds'),
),
]
23 changes: 23 additions & 0 deletions IizakaEmpire/MyBlog/migrations/0012_auto_20210103_2239.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.1.2 on 2021-01-03 13:39

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('MyBlog', '0011_auto_20201129_2320'),
]

operations = [
migrations.AlterField(
model_name='article',
name='pub_date',
field=models.DateField(auto_now_add=True, verbose_name='作成日時'),
),
migrations.AlterField(
model_name='article',
name='up_date',
field=models.DateField(auto_now=True, verbose_name='更新日時'),
),
]
44 changes: 25 additions & 19 deletions IizakaEmpire/MyBlog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,41 @@
# Create your models here.

class Category(models.Model):
name=models.CharField(max_length=16)
slug=models.SlugField(max_length=8,unique=True)
name = models.CharField(max_length=16)
slug = models.SlugField(max_length=8,unique=True)

def __str__(self):
return self.name


class Kinds(models.Model):
name = models.CharField(max_length=8)
slug = models.SlugField(max_length=16, unique=True)

def __str__(self):
return self.name


class Tag(models.Model):
name=models.CharField(max_length=16)
slug=models.SlugField(max_length=8,unique=True)
name = models.CharField(max_length=16)
slug = models.SlugField(max_length=8, unique=True)
kind = models.ForeignKey(Kinds, on_delete=models.CASCADE, blank=True, null=True)

def __str__(self):
return self.name


class Article(models.Model):
slug=models.SlugField(max_length=16,unique=True)
category=models.ForeignKey(Category,on_delete=models.CASCADE)
tags=models.ManyToManyField(Tag)
title=models.CharField(max_length=64)
meta_description=models.CharField(max_length=64)
ogp_title=models.CharField(max_length=32)
ogp_img=models.ImageField(upload_to='ogp_img')
pub_date=models.DateTimeField('作成日時',auto_now_add=True)
up_date=models.DateTimeField('更新日時',auto_now=True)
contents=MarkdownxField('Contents',help_text='box9 is note box<div>\n outline is list <ul class="outline"><li><h4></h4></li></ul>')
slug = models.SlugField(max_length=32, unique=True)
category = models.ForeignKey(Category, on_delete=models.CASCADE)
tags = models.ManyToManyField(Tag)
title = models.CharField(max_length=64)
meta_description = models.CharField(max_length=128)
ogp_title = models.CharField(max_length=32)
ogp_img = models.ImageField(upload_to='ogp_img')
pub_date = models.DateField('作成日時',auto_now_add=True)
up_date = models.DateField('更新日時',auto_now=True)
contents = MarkdownxField('Contents',help_text='box9 is note box<div>\n outline is list <ul class="outline"><li><h4></h4></li></ul>')

def __str__(self):
return self.title
Expand All @@ -39,11 +50,6 @@ class Meta:
def exchange_markdown(self):
return markdownify(self.contents)

# def get_absolute_url(self):
# return reverse('MyBlog:blog',kwargs={
# 'div':self.category.slug,
# 'blog_id':self.slug,
# })

class Author(models.Model):
profimg=models.ImageField(upload_to='author/')
Expand Down
14 changes: 14 additions & 0 deletions IizakaEmpire/MyBlog/serializer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from rest_framework import serializers

from .models import Tag, Article

class TagEntry(serializers.ModelSerializer):
class Meta:
model = Tag
fields = ('name','slug')


class ArticleEntry(serializers.ModelSerializer):
class Meta:
model = Article
fields = ('slug', 'category', 'meta_description', 'ogp_title', 'ogp_img', 'pub_date')
39 changes: 39 additions & 0 deletions IizakaEmpire/MyBlog/static/amazon_link.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.amazon-container {
background: #fff;
width: 100%;
overflow: hidden;
border: 1px solid #f90;
border-top: 2px solid #f90;
padding: 0;
}

.amazon-img {
margin: 1em;
border: none;
width: 33%;
float: left;
}

.amazon-img img {
width:100%;
height: auto;
}

.amazon-text {
font-size: 13px;
color: #0066c0;
margin: 1em;
padding-top: 2em;
}

.amazon-clear {
clear: both;
}

.amazon-footer {
font-size: 13px;
text-align: right;
padding-right: 1em;
color: #333;
background: linear-gradient(to bottom,#f8e6b8 0,#f3d686 6%,#ebb62c 100%);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
body{
background-color: lightgray !important;
}

.back_color{
background-color: whitesmoke;
}


.box7{
padding: 0.5em 1em;
margin: 2em 0;
Expand Down Expand Up @@ -77,6 +86,7 @@
}

.box27 {
background: whitesmoke;/*背景色*/
position: relative;
margin: 2em 0;
padding: 0.5em 1em;
Expand All @@ -100,28 +110,6 @@
margin: 0;
padding: 0;
}

@media only screen and (max-width: 767px){

img {
display: block;
max-width: 60%;
height: auto;
margin-left: auto;
margin-right: auto;
}

}

@media only screen and (min-width: 767px),print{
img {
display: block;
max-width: 50%;
height: auto;
margin-left: auto;
margin-right: auto;
}
}
div a {
text-decoration: none;
text-emphasis: none;
Expand Down
Binary file not shown.
Loading

0 comments on commit 814b32e

Please sign in to comment.