Skip to content

Commit

Permalink
simple system
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffithLin committed Apr 27, 2019
1 parent 012e1c7 commit 1657b52
Show file tree
Hide file tree
Showing 59 changed files with 3,748 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/my_bbs.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
<nature>org.python.pydev.django.djangoNature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions .pydevproject
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
<pydev_variables_property name="org.python.pydev.PROJECT_VARIABLE_SUBSTITUTION">
<key>DJANGO_MANAGE_LOCATION</key>
<value>manage.py</value>
<key>PY</key>
<value>37</value>
</pydev_variables_property>
</pydev_project>
Binary file added blog/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added blog/__pycache__/admin.cpython-37.pyc
Binary file not shown.
Binary file added blog/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file added blog/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file added blog/__pycache__/views.cpython-37.pyc
Binary file not shown.
51 changes: 51 additions & 0 deletions blog/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2019-04-26 07:22
from __future__ import unicode_literals

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='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=70)),
('body', models.TextField()),
('created_time', models.DateTimeField()),
('modified_time', models.DateTimeField()),
('excerpt', models.CharField(blank=True, max_length=200)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category')),
],
),
migrations.CreateModel(
name='Tag',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
],
),
migrations.AddField(
model_name='post',
name='tags',
field=models.ManyToManyField(blank=True, to='blog.Tag'),
),
]
Binary file not shown.
Binary file added blog/migrations/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
49 changes: 27 additions & 22 deletions blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Create your models here.

class Category(models.Model):
"""
"""
Django 要求模型必须继承 models.Model 类。
Category 只需要一个简单的分类名 name 就可以了。
CharField 指定了分类名 name 的数据类型,CharField 是字符型,
Expand All @@ -14,31 +14,36 @@ class Category(models.Model):
https://docs.djangoproject.com/en/1.10/ref/models/fields/#field-types
"""
name = models.CharField(max_length=100)

def __str__(self):
return self.name

class Tag(models.Model):
"""
"""
标签 Tag 也比较简单,和 Category 一样。
再次强调一定要继承 models.Model 类!
"""
name = models.CharField(max_length=100)

name = models.CharField(max_length=100)
def __str__(self):
return self.name

class Post(models.Model):
"""
"""
文章的数据库表稍微复杂一点,主要是涉及的字段更多。
"""

#title
title = models.CharField(max_length=70)
body = models.TextField()
created_time = models.DateTimeField()
modified_time = models.DateTimeField()
#摘要 允许空
excerpt = models.CharField(max_length=200,blank=True)

category = models.ForeignKey(Category)
tags = models.ManyToManyField(Tag,blank=True)
# 文章作者,这里 User 是从 django.contrib.auth.models 导入的。
author = models.ForeignKey(User)




#title
title = models.CharField(max_length=70)
body = models.TextField()
created_time = models.DateTimeField()
modified_time = models.DateTimeField()
#摘要 允许空
excerpt = models.CharField(max_length=200,blank=True)

category = models.ForeignKey(Category)
tags = models.ManyToManyField(Tag,blank=True)
# 文章作者,这里 User 是从 django.contrib.auth.models 导入的。
author = models.ForeignKey(User)
def __str__(self):
return self.title


1 change: 1 addition & 0 deletions blog/static/blog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
115 changes: 115 additions & 0 deletions blog/static/blog/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html>
<head>
<title>Black &amp; White</title>

<!-- meta -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- css -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/ionicons.min.css">
<link rel="stylesheet" href="css/pace.css">
<link rel="stylesheet" href="css/custom.css">

<!-- js -->
<script src="js/jquery-2.1.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/pace.min.js"></script>
<script src="js/modernizr.custom.js"></script>
</head>

<body id="page">
<div class="container">
<header id="site-header">
<div class="row">
<div class="col-md-4 col-sm-5 col-xs-8">
<div class="logo">
<h1><a href="index.html"><b>Black</b> &amp; White</a></h1>
</div>
</div><!-- col-md-4 -->
<div class="col-md-8 col-sm-7 col-xs-4">
<nav class="main-nav" role="navigation">
<div class="navbar-header">
<button type="button" id="trigger-overlay" class="navbar-toggle">
<span class="ion-navicon"></span>
</button>
</div>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="cl-effect-11"><a href="index.html" data-hover="Home">Home</a></li>
<li class="cl-effect-11"><a href="full-width.html" data-hover="Blog">Blog</a></li>
<li class="cl-effect-11"><a href="about.html" data-hover="About">About</a></li>
<li class="cl-effect-11"><a href="contact.html" data-hover="Contact">Contact</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
<div id="header-search-box">
<a id="search-menu" href="#"><span id="search-icon" class="ion-ios-search-strong"></span></a>
<div id="search-form" class="search-form">
<form role="search" method="get" id="searchform" action="#">
<input type="search" placeholder="Search" required>
<button type="submit"><span class="ion-ios-search-strong"></span></button>
</form>
</div>
</div>
</div><!-- col-md-8 -->
</div>
</header>
</div>

<div class="content-body">
<div class="container">
<div class="row">
<main class="col-md-12">
<h1 class="page-title">About Me</h1>
<article class="post">
<div class="entry-content clearfix">
<figure class="img-responsive-center">
<img class="img-responsive" src="img/me.jpg" alt="Developer Image">
</figure>
<p>Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.</p>
<p>Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.</p>
<div class="height-40px"></div>
<h2 class="title text-center">Social</h2>
<ul class="social">
<li class="facebook"><a href="#"><span class="ion-social-facebook"></span></a></li>
<li class="twitter"><a href="#"><span class="ion-social-twitter"></span></a></li>
<li class="google-plus"><a href="#"><span class="ion-social-googleplus"></span></a></li>
<li class="tumblr"><a href="#"><span class="ion-social-tumblr"></span></a></li>
</ul>
</div>
</article>
</main>
</div>
</div>
</div>
<footer id="site-footer">
<div class="container">
<div class="row">
<div class="col-md-12">
<p class="copyright">&copy; 2014 ThemeWagon.com</p>
</div>
</div>
</div>
</footer>

<!-- Mobile Menu -->
<div class="overlay overlay-hugeinc">
<button type="button" class="overlay-close"><span class="ion-ios-close-empty"></span></button>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="full-width.html">Blog</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</div>

<script src="js/script.js"></script>

</body>
</html>
Loading

0 comments on commit 1657b52

Please sign in to comment.