-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
121 changed files
with
3,920 additions
and
1 deletion.
There are no files selected for viewing
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,10 @@ | ||
from django.contrib import admin | ||
from .models import BlogType, Blog | ||
|
||
@admin.register(BlogType) | ||
class BlogTypeAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'type_name') | ||
|
||
@admin.register(Blog) | ||
class BlogAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'title', 'blog_type', 'author', 'get_read_num', 'created_time', 'last_updated_time') |
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,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class BlogConfig(AppConfig): | ||
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,40 @@ | ||
# Generated by Django 2.0 on 2017-12-24 17:50 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Blog', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=50)), | ||
('content', models.TextField()), | ||
('created_time', models.DateTimeField(auto_now_add=True)), | ||
('last_updated_time', models.DateTimeField(auto_now=True)), | ||
('author', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='BlogType', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('type_name', models.CharField(max_length=15)), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='blog', | ||
name='blog_type', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='blog.BlogType'), | ||
), | ||
] |
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,17 @@ | ||
# Generated by Django 2.0 on 2018-01-19 18:10 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='blog', | ||
options={'ordering': ['-created_time']}, | ||
), | ||
] |
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,19 @@ | ||
# Generated by Django 2.0 on 2018-02-04 17:47 | ||
|
||
import ckeditor.fields | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0002_auto_20180120_0210'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='blog', | ||
name='content', | ||
field=ckeditor.fields.RichTextField(), | ||
), | ||
] |
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,19 @@ | ||
# Generated by Django 2.0 on 2018-02-04 18:05 | ||
|
||
import ckeditor_uploader.fields | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0003_auto_20180205_0147'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='blog', | ||
name='content', | ||
field=ckeditor_uploader.fields.RichTextUploadingField(), | ||
), | ||
] |
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,18 @@ | ||
# Generated by Django 2.0 on 2018-02-07 16:59 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0004_auto_20180205_0205'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='blog', | ||
name='readed_num', | ||
field=models.IntegerField(default=0), | ||
), | ||
] |
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,30 @@ | ||
# Generated by Django 2.0 on 2018-02-23 17:32 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0005_blog_readed_num'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ReadNum', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('read_num', models.IntegerField(default=0)), | ||
], | ||
), | ||
migrations.RemoveField( | ||
model_name='blog', | ||
name='readed_num', | ||
), | ||
migrations.AddField( | ||
model_name='readnum', | ||
name='blog', | ||
field=models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, to='blog.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,20 @@ | ||
# Generated by Django 2.0 on 2018-02-23 18:12 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0006_auto_20180224_0132'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='readnum', | ||
name='blog', | ||
), | ||
migrations.DeleteModel( | ||
name='ReadNum', | ||
), | ||
] |
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,25 @@ | ||
# Generated by Django 2.0 on 2018-04-25 16:48 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0007_auto_20180224_0212'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='blog', | ||
name='author', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='blog', | ||
name='blog_type', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.BlogType'), | ||
), | ||
] |
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,36 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
from django.contrib.contenttypes.fields import GenericRelation | ||
from django.urls import reverse | ||
from ckeditor_uploader.fields import RichTextUploadingField | ||
from read_statistics.models import ReadNumExpandMethod, ReadDetail | ||
|
||
class BlogType(models.Model): | ||
type_name = models.CharField(max_length=15) | ||
|
||
def __str__(self): | ||
return self.type_name | ||
|
||
class Blog(models.Model, ReadNumExpandMethod): | ||
title = models.CharField(max_length=50) | ||
blog_type = models.ForeignKey(BlogType, on_delete=models.CASCADE) | ||
content = RichTextUploadingField() | ||
author = models.ForeignKey(User, on_delete=models.CASCADE) | ||
read_details = GenericRelation(ReadDetail) | ||
created_time = models.DateTimeField(auto_now_add=True) | ||
last_updated_time = models.DateTimeField(auto_now=True) | ||
|
||
def get_url(self): | ||
return reverse('blog_detail', kwargs={'blog_pk': self.pk}) | ||
|
||
def get_user(self): | ||
return self.author | ||
|
||
def get_email(self): | ||
return self.author.email | ||
|
||
def __str__(self): | ||
return "<Blog: %s>" % self.title | ||
|
||
class Meta: | ||
ordering = ['-created_time'] |
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,76 @@ | ||
ul.blog-types { | ||
list-style-type: none; | ||
} | ||
div.blog:not(:last-child){ | ||
margin-bottom: 2em; | ||
padding-bottom: 1em; | ||
border-bottom: 1px solid #eee; | ||
} | ||
div.blog h3 { | ||
margin-top: 0.5em; | ||
} | ||
div.blog p.blog-info { | ||
margin-bottom: 0; | ||
} | ||
div.paginator { | ||
text-align: center; | ||
} | ||
|
||
ul.blog-info-description { | ||
list-style-type: none; | ||
margin-bottom: 1em; | ||
} | ||
ul.blog-info-description li{ | ||
display: inline-block; | ||
margin-right: 1em; | ||
} | ||
div.blog-content{ | ||
text-indent: 2em; | ||
margin-bottom: 2em; | ||
} | ||
div.blog-more { | ||
margin-top: 1em; | ||
} | ||
|
||
div.comment-area { | ||
margin-top: 2em; | ||
} | ||
h3.comment-area-title { | ||
border-bottom: 1px solid #ccc; | ||
padding-bottom: 0.4em; | ||
} | ||
|
||
div.django-ckeditor-widget { | ||
width: 100%; | ||
} | ||
|
||
div.comment { | ||
border-bottom: 1px dashed #ccc; | ||
margin-bottom: 0.5em; | ||
padding-bottom: 0.5em; | ||
} | ||
div.reply { | ||
margin-left: 2em; | ||
} | ||
div#reply_content_container { | ||
border: 1px solid #d1d1d1; | ||
border-bottom: none; | ||
background-color: #f8f8f8; | ||
overflow: hidden; | ||
padding: 1em 1em 0.5em; | ||
} | ||
p#reply_title { | ||
border-bottom: 1px dashed #ccc; | ||
padding-bottom: 0.5em; | ||
} | ||
|
||
div.like { | ||
color: #337ab7; | ||
cursor: pointer; | ||
display: inline-block; | ||
padding: 0.5em 0.3em; | ||
} | ||
|
||
div.like .active{ | ||
color: #f22; | ||
} |
Oops, something went wrong.