├── blog
├── __init__.py
├── __pycache__
│ ├── __init__.cpython-37.pyc
│ ├── admin.cpython-37.pyc
│ ├── forms.cpython-37.pyc
│ ├── models.cpython-37.pyc
│ ├── urls.cpython-37.pyc
│ └── views.cpython-37.pyc
├── admin.py
├── apps.py
├── forms.py
├── migrations
│ ├── 0001_initial.py
│ ├── 0002_post_pub_date.py
│ ├── 0003_auto_20200416_1020.py
│ ├── 0004_post_timestamp.py
│ ├── __init__.py
│ └── __pycache__
│ │ ├── 0001_initial.cpython-37.pyc
│ │ ├── 0002_post_pub_date.cpython-37.pyc
│ │ ├── 0003_auto_20200416_1020.cpython-37.pyc
│ │ ├── 0004_post_timestamp.cpython-37.pyc
│ │ └── __init__.cpython-37.pyc
├── models.py
├── templates
│ ├── add_post.html
│ ├── article_details.html
│ ├── base.html
│ ├── delete_post.html
│ ├── edit_post.html
│ └── home.html
├── tests.py
├── urls.py
└── views.py
├── db.sqlite3
├── manage.py
├── members
├── __init__.py
├── __pycache__
│ ├── __init__.cpython-37.pyc
│ ├── admin.cpython-37.pyc
│ ├── models.cpython-37.pyc
│ ├── urls.cpython-37.pyc
│ └── views.cpython-37.pyc
├── admin.py
├── apps.py
├── migrations
│ ├── __init__.py
│ └── __pycache__
│ │ └── __init__.cpython-37.pyc
├── models.py
├── templates
│ └── registration
│ │ ├── login.html
│ │ └── register.html
├── tests.py
├── urls.py
└── views.py
└── simpleblog
├── __init__.py
├── __pycache__
├── __init__.cpython-37.pyc
├── settings.cpython-37.pyc
├── urls.cpython-37.pyc
└── wsgi.cpython-37.pyc
├── asgi.py
├── settings.py
├── urls.py
└── wsgi.py
/blog/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__init__.py
--------------------------------------------------------------------------------
/blog/__pycache__/__init__.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/__init__.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/__pycache__/admin.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/admin.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/__pycache__/forms.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/forms.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/__pycache__/models.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/models.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/__pycache__/urls.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/urls.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/__pycache__/views.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/__pycache__/views.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 | from .models import Post
3 |
4 | admin.site.register(Post)
--------------------------------------------------------------------------------
/blog/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class BlogConfig(AppConfig):
5 | name = 'blog'
6 |
--------------------------------------------------------------------------------
/blog/forms.py:
--------------------------------------------------------------------------------
1 | from django import forms
2 | from .models import Post
3 |
4 |
5 | class PostForm(forms.ModelForm):
6 | class Meta:
7 | model = Post
8 | fields = ('title', 'author', 'body')
9 | widgets = {
10 | 'title': forms.TextInput(attrs={'class': 'form-control'}),
11 | 'author': forms.Select(attrs={'class': 'form-control'}),
12 | 'body': forms.Textarea(attrs={'class': 'form-control', 'placeholder': "Body"}),
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/blog/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.0.5 on 2020-04-02 16:02
2 |
3 | from django.conf import settings
4 | from django.db import migrations, models
5 | import django.db.models.deletion
6 |
7 |
8 | class Migration(migrations.Migration):
9 |
10 | initial = True
11 |
12 | dependencies = [
13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14 | ]
15 |
16 | operations = [
17 | migrations.CreateModel(
18 | name='Post',
19 | fields=[
20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21 | ('title', models.CharField(max_length=255)),
22 | ('body', models.TextField()),
23 | ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
24 | ],
25 | ),
26 | ]
27 |
--------------------------------------------------------------------------------
/blog/migrations/0002_post_pub_date.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.0.5 on 2020-04-16 17:09
2 |
3 | from django.db import migrations, models
4 | import django.utils.timezone
5 |
6 |
7 | class Migration(migrations.Migration):
8 |
9 | dependencies = [
10 | ('blog', '0001_initial'),
11 | ]
12 |
13 | operations = [
14 | migrations.AddField(
15 | model_name='post',
16 | name='pub_date',
17 | field=models.DateField(default=django.utils.timezone.now),
18 | preserve_default=False,
19 | ),
20 | ]
21 |
--------------------------------------------------------------------------------
/blog/migrations/0003_auto_20200416_1020.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.0.5 on 2020-04-16 17:20
2 |
3 | from django.db import migrations, models
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | dependencies = [
9 | ('blog', '0002_post_pub_date'),
10 | ]
11 |
12 | operations = [
13 | migrations.AlterField(
14 | model_name='post',
15 | name='pub_date',
16 | field=models.DateField(auto_now_add=True),
17 | ),
18 | ]
19 |
--------------------------------------------------------------------------------
/blog/migrations/0004_post_timestamp.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.0.5 on 2020-04-16 17:30
2 |
3 | from django.db import migrations, models
4 | import django.utils.timezone
5 |
6 |
7 | class Migration(migrations.Migration):
8 |
9 | dependencies = [
10 | ('blog', '0003_auto_20200416_1020'),
11 | ]
12 |
13 | operations = [
14 | migrations.AddField(
15 | model_name='post',
16 | name='timestamp',
17 | field=models.DateField(auto_now_add=True, default=django.utils.timezone.now),
18 | preserve_default=False,
19 | ),
20 | ]
21 |
--------------------------------------------------------------------------------
/blog/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__init__.py
--------------------------------------------------------------------------------
/blog/migrations/__pycache__/0001_initial.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/0001_initial.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/migrations/__pycache__/0002_post_pub_date.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/0002_post_pub_date.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/migrations/__pycache__/0003_auto_20200416_1020.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/0003_auto_20200416_1020.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/migrations/__pycache__/0004_post_timestamp.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/0004_post_timestamp.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/migrations/__pycache__/__init__.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flatplanet/django-ablog/c7cc3e27c29392158c28f4b46d5f403646b965ce/blog/migrations/__pycache__/__init__.cpython-37.pyc
--------------------------------------------------------------------------------
/blog/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 | from django.contrib.auth.models import User
3 | from django.urls import reverse
4 | from datetime import datetime, date
5 |
6 | class Post(models.Model):
7 | title = models.CharField(max_length=255)
8 | author = models.ForeignKey(User, on_delete=models.CASCADE)
9 | body = models.TextField()
10 | pub_date = models.DateField(auto_now_add=True)
11 | timestamp = models.DateField(auto_now_add=True)
12 |
13 | def __str__(self):
14 | return self.title + ' | ' + str(self.author)
15 | def get_absolute_url(self):
16 | return reverse('home')
17 |
--------------------------------------------------------------------------------
/blog/templates/add_post.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 |
3 |
4 | {% block content %}
5 |
6 | {% if user.is_authenticated %}
7 |
Add Post...
8 |
9 |
13 |
14 |
15 |
16 | {% endblock %}
17 |
--------------------------------------------------------------------------------
/blog/templates/edit_post.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 |
3 |
4 | {% block content %}
5 | Edit Post...
6 |
7 |