Permalink
Browse files

6 - First App & Model

  • Loading branch information...
codingforentrepreneurs committed Dec 15, 2015
1 parent 2424c5b commit 10e740127a6c8f9f72ed767aca3550bc7b39bb5c
BIN +0 Bytes (100%) .DS_Store
Binary file not shown.
BIN +0 Bytes (100%) src/.DS_Store
Binary file not shown.
BIN +4 KB (100%) src/db.sqlite3
Binary file not shown.
No changes.
@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.
@@ -0,0 +1,5 @@
from django.apps import AppConfig
class PostsConfig(AppConfig):
name = 'posts'
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-15 01:09
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')),
('title', models.CharField(max_length=120)),
('content', models.TextField()),
('updated', models.DateTimeField(auto_now=True)),
('timestamp', models.DateTimeField(auto_now_add=True)),
],
),
]
No changes.
@@ -0,0 +1,18 @@
from __future__ import unicode_literals
from django.db import models
# Create your models here.
# MVC MODEL VIEW CONTROLLER
class Post(models.Model):
title = models.CharField(max_length=120)
content = models.TextField()
updated = models.DateTimeField(auto_now=True, auto_now_add=False)
timestamp = models.DateTimeField(auto_now=False, auto_now_add=True)
def __unicode__(self):
return self.title
def __str__(self):
return self.title
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
@@ -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',
]
MIDDLEWARE_CLASSES = [

0 comments on commit 10e7401

Please sign in to comment.