Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ static/
assets/node_modules/
assets/.sass-cache/
*style.css.map
.vscode/
4 changes: 4 additions & 0 deletions account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import password_validation

from wagtail.snippets.models import register_snippet



def upload_avatar_to(instance, filename):
filename, ext = os.path.splitext(filename)
Expand Down Expand Up @@ -41,6 +44,7 @@ def create_superuser(self, email, password, **extra_fields):
return self.create_user(email, password, **extra_fields)


@register_snippet
class User(AbstractBaseUser, PermissionsMixin):
""" Custom user model
"""
Expand Down
2 changes: 1 addition & 1 deletion assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ $(document).ready(function() {

}, 0);

$.get('/recent/', function( response ) {
$.get('/blog/recent/', function( response ) {
var template = $("#recent_blog_tpl").html();
$("#recent_blog").html(_.template(template)({posts:response}));
});
Expand Down
19 changes: 19 additions & 0 deletions blog/migrations/0002_auto_20200206_0701.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.2 on 2020-02-06 07:01

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('blog', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='blogpage',
name='main_image',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='public.SwiftkindImage'),
),
]
5 changes: 3 additions & 2 deletions blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from modelcluster.fields import ParentalKey
from modelcluster.contrib.taggit import ClusterTaggableManager
from taggit.models import TaggedItemBase, Tag
from public.image import SwiftkindImage


class BlogPageTag(TaggedItemBase):
Expand All @@ -29,7 +30,7 @@ class BlogPage(Page):
""" Blog page models
"""
main_image = models.ForeignKey(
'wagtailimages.Image',
'public.SwiftkindImage',
null=True,
blank=True,
on_delete=models.SET_NULL,
Expand All @@ -45,7 +46,7 @@ class BlogPage(Page):

content_panels = Page.content_panels + [
ImageChooserPanel('main_image'),
FieldPanel('body'),
FieldPanel('body', classname='full'),
FieldPanel('tags')
]

Expand Down
4 changes: 1 addition & 3 deletions blog/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
from .views import RecentBlogView

urlpatterns = [
re_path(r'cms/', include(wagtailadmin_urls)),
re_path(r'blog/', include(wagtail_urls)),
path('recent/', RecentBlogView.as_view(), name='recent_posts')
path('recent/', RecentBlogView.as_view(), name='recent_posts'),
]
Loading