Added admin
authorNeil Smith <neil.git@njae.me.uk>
Mon, 3 Oct 2016 20:36:14 +0000 (21:36 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Mon, 3 Oct 2016 20:36:14 +0000 (21:36 +0100)
.gitignore
blog/__init__.py [new file with mode: 0644]
blog/admin.py [new file with mode: 0644]
blog/apps.py [new file with mode: 0644]
blog/migrations/0001_initial.py [new file with mode: 0644]
blog/migrations/__init__.py [new file with mode: 0644]
blog/models.py [new file with mode: 0644]
blog/tests.py [new file with mode: 0644]
blog/views.py [new file with mode: 0644]
mysite/django-girls.sublime-project
mysite/settings.py

index 0546add21afd94c4049024b4460cc795e622f65a..16c050f616517265977fe93ce9618601852e550a 100644 (file)
@@ -43,3 +43,6 @@ nosetests.xml
 
 # Logs
 *.log
+
+# Databases
+*sqlite3
diff --git a/blog/__init__.py b/blog/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/blog/admin.py b/blog/admin.py
new file mode 100644 (file)
index 0000000..47f03fd
--- /dev/null
@@ -0,0 +1,4 @@
+from django.contrib import admin
+from .models import Post
+
+admin.site.register(Post)
diff --git a/blog/apps.py b/blog/apps.py
new file mode 100644 (file)
index 0000000..7930587
--- /dev/null
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class BlogConfig(AppConfig):
+    name = 'blog'
diff --git a/blog/migrations/0001_initial.py b/blog/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..91bc243
--- /dev/null
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.2 on 2016-10-03 10:57
+from __future__ import unicode_literals
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Post',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('title', models.CharField(max_length=300)),
+                ('text', models.TextField()),
+                ('created_date', models.DateTimeField(default=django.utils.timezone.now)),
+                ('published_date', models.DateTimeField(blank=True, null=True)),
+                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+            ],
+        ),
+    ]
diff --git a/blog/migrations/__init__.py b/blog/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/blog/models.py b/blog/models.py
new file mode 100644 (file)
index 0000000..88c2bb1
--- /dev/null
@@ -0,0 +1,16 @@
+from django.db import models
+from django.utils import timezone
+
+class Post(models.Model):
+       author = models.ForeignKey('auth.User')
+       title = models.CharField(max_length=300)
+       text = models.TextField()
+       created_date = models.DateTimeField(default=timezone.now)
+       published_date = models.DateTimeField(blank=True, null=True)
+
+       def publish(self):
+               self.published_date = timezone.now()
+               self.save()
+
+       def __str__(self):
+               return self.title
diff --git a/blog/tests.py b/blog/tests.py
new file mode 100644 (file)
index 0000000..7ce503c
--- /dev/null
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/blog/views.py b/blog/views.py
new file mode 100644 (file)
index 0000000..91ea44a
--- /dev/null
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
index 24db30311b340c8d78001f0fb705810ab77a8c38..6912d5a41119154d3f5d8604616ee9b8efb75c07 100644 (file)
@@ -3,6 +3,12 @@
        [
                {
                        "path": "."
+               },
+               {
+                       "path": "/home/neil/Documents/programming/django-girls/blog"
+               },
+               {
+                       "path": "/home/neil/Documents/programming/django-girls"
                }
        ]
 }
index fc1e9657e814cd0e5010f969345051816290dee1..ff02bb646b12bc263a8faf38fca45fa6e903e982 100644 (file)
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'blog'
 ]
 
 MIDDLEWARE = [