-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
117 additions
and
6 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
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
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
# MVC stuff | ||
'blog', | ||
'search', | ||
'gallery', | ||
# Stuff | ||
'wagtail.locales', | ||
# API engine | ||
|
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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class GalleryConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'gallery' |
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,41 @@ | ||
# Generated by Django 4.2.13 on 2024-05-15 16:55 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
('wagtailcore', '0093_uploadedfile'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Picture', | ||
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(verbose_name='Post Date')), | ||
( | ||
'image', | ||
models.ImageField(blank=True, upload_to='', verbose_name='Picture'), | ||
), | ||
('cap', models.CharField(max_length=1024, verbose_name='Caption')), | ||
], | ||
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,39 @@ | ||
from django.db import models | ||
from wagtail.models import Page | ||
from wagtail.admin.panels import FieldPanel | ||
from wagtail.api import APIField | ||
|
||
from rest_framework.fields import DateField | ||
|
||
# add this: | ||
from wagtail.search import index | ||
|
||
# keep the definition of BlogIndexPage model, and add the BlogPage model: | ||
|
||
|
||
class Picture(Page): | ||
date = models.DateField('Post Date') | ||
image = models.ImageField('Picture', blank=True) | ||
cap = models.CharField('Caption', max_length=1024) | ||
|
||
search_fields = Page.search_fields + [ | ||
index.SearchField('cap'), | ||
] | ||
|
||
content_panels = Page.content_panels + [ | ||
FieldPanel('date'), | ||
FieldPanel('cap'), | ||
FieldPanel('image'), | ||
] | ||
|
||
api_fields = [ | ||
APIField( | ||
'date', | ||
serializer=DateField(format='%Y-%m-%dT%H:%M:%SZ'), | ||
), | ||
APIField('cap'), | ||
APIField('image'), | ||
# APIField( | ||
# 'authors' | ||
# ), # This will nest the relevant BlogPageAuthor objects in the API response | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,4 @@ def search(request): | |
# }, | ||
# ) | ||
|
||
pass | ||
pass |