Add posts #2

Merged
merged 7 commits into from Dec 29, 2016
Next

Add a post model

commit efd18e5c6415de0d0cba317122c0d3bbfc614f64 @dwayne dwayne committed Nov 30, 2016
No changes.
View
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
View
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class PostsConfig(AppConfig):
+ name = 'posts'
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2016-12-20 14:38
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Post',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('is_published', models.BooleanField(default=False)),
+ ('title', models.CharField(max_length=100)),
+ ('slug', models.SlugField(max_length=100, unique=True)),
+ ('excerpt', models.TextField()),
+ ('body', models.TextField()),
+ ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='date created')),
+ ('updated_at', models.DateTimeField(auto_now=True, verbose_name='last modified')),
+ ('published_at', models.DateTimeField(blank=True, null=True, verbose_name='date published')),
+ ],
+ ),
+ ]
No changes.
View
@@ -0,0 +1,22 @@
+from django.db import models
+
+
+class Post(models.Model):
+ is_published = models.BooleanField(default=False)
+
+ title = models.CharField(max_length=100)
+
+ slug = models.SlugField(max_length=100, unique=True)
+
+ excerpt = models.TextField()
+
+ body = models.TextField()
+
+ created_at = models.DateTimeField('date created', auto_now_add=True)
+
+ updated_at = models.DateTimeField('last modified', auto_now=True)
+
+ published_at = models.DateTimeField('date published', null=True, blank=True)
+
+ def __str__(self):
+ return self.title
View
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
View
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
@@ -37,6 +37,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'posts.apps.PostsConfig',
]
MIDDLEWARE = [