Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Articles, authors, Bootstrap, Webpack...
- Loading branch information
Showing
34 changed files
with
8,145 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/*.sqlite3 | ||
/node_modules/ | ||
/pipeline/static/webpack_bundles/ | ||
/media/ | ||
/webpack-stats.json | ||
/.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ArticlesConfig(AppConfig): | ||
name = 'articles' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 2.0.7 on 2018-07-08 18:01 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import wagtail.core.blocks | ||
import wagtail.core.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('wagtailcore', '0040_page_draft_title'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ArticlePage', | ||
fields=[ | ||
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), | ||
('date', models.DateField()), | ||
('body', wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock())])), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('wagtailcore.page',), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 2.0.7 on 2018-07-10 01:42 | ||
|
||
from django.db import migrations | ||
import wagtail.core.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('articles', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='articlepage', | ||
name='headline', | ||
field=wagtail.core.fields.RichTextField(default='hi'), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 2.0.7 on 2018-07-12 03:09 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailcore', '0040_page_draft_title'), | ||
('articles', '0002_articlepage_headline'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ArticlesIndex', | ||
fields=[ | ||
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('wagtailcore.page',), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from django.db import models | ||
|
||
from wagtail.core.models import Page | ||
from wagtail.core.fields import RichTextField, StreamField | ||
from wagtail.core.blocks import RichTextBlock | ||
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel | ||
|
||
from bs4 import BeautifulSoup | ||
|
||
|
||
class ArticlePage(Page): | ||
headline = RichTextField(features=['italic']) | ||
date = models.DateField() | ||
body = StreamField([ | ||
('paragraph', RichTextBlock()), | ||
]) | ||
|
||
content_panels = [ | ||
FieldPanel('headline'), | ||
FieldPanel('date'), | ||
StreamFieldPanel('body'), | ||
] | ||
|
||
def clean(self): | ||
super().clean() | ||
|
||
soup = BeautifulSoup(self.headline) | ||
self.title = soup.text | ||
|
||
|
||
class ArticlesIndex(Page): | ||
subpage_types = ['ArticlePage'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AuthorsConfig(AppConfig): | ||
name = 'authors' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 2.0.7 on 2018-07-11 15:11 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Author', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('first_name', models.CharField(max_length=255)), | ||
('last_name', models.CharField(max_length=255)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 2.0.7 on 2018-07-11 15:47 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailcore', '0040_page_draft_title'), | ||
('authors', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='AuthorPage', | ||
fields=[ | ||
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), | ||
('first_name', models.CharField(max_length=255)), | ||
('last_name', models.CharField(max_length=255)), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('wagtailcore.page',), | ||
), | ||
migrations.DeleteModel( | ||
name='Author', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 2.0.7 on 2018-07-11 15:56 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailcore', '0040_page_draft_title'), | ||
('authors', '0002_auto_20180711_1547'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='AuthorsIndexPage', | ||
fields=[ | ||
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('wagtailcore.page',), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from django.db import models | ||
from django.utils.text import slugify | ||
|
||
from wagtail.core.models import Page | ||
from wagtail.core.fields import RichTextField | ||
from wagtail.admin.edit_handlers import FieldPanel | ||
from wagtail.snippets.models import register_snippet | ||
from wagtail.search import index | ||
|
||
|
||
class AuthorPage(Page): | ||
first_name = models.CharField(max_length=255) | ||
last_name = models.CharField(max_length=255) | ||
|
||
content_panels = [ | ||
FieldPanel('first_name'), | ||
FieldPanel('last_name'), | ||
] | ||
|
||
search_fields = [ | ||
index.SearchField('first_name'), | ||
index.SearchField('last_name'), | ||
] | ||
|
||
def clean(self): | ||
super().clean() | ||
self.title = f'{self.first_name} {self.last_name}' | ||
|
||
# AuthorPage.slug.default = 'blank-slug' | ||
|
||
|
||
class AuthorsIndexPage(Page): | ||
subpage_types = ['AuthorPage'] | ||
|
||
def get_authors(self): | ||
return AuthorPage.objects.live().descendant_of(self).order_by('title') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends "base.html" %} | ||
|
||
{% load wagtailcore_tags %} | ||
|
||
{% block body_class %}template-homepage{% endblock %} | ||
|
||
{% block content %} | ||
<h1>{{ page.title }}</h1> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% extends "base.html" %} | ||
|
||
{% load wagtailcore_tags %} | ||
|
||
{% block body_class %}template-homepage{% endblock %} | ||
|
||
{% block content %} | ||
<h1>Authors</h1> | ||
|
||
{% for author in page.get_authors %} | ||
<a href="{% pageurl author %}">{{ author.title }}</a> | ||
{% endfor %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.