Commit 70bfb148 authored by gijs's avatar gijs
Browse files

Ẅoops :-$

parent 1c7863d4
......@@ -116,56 +116,55 @@ class Image (index.Indexed, models.Model):
@register_snippet
class Project(index.Indexed, models.Model):
title = models.CharField(max_length=250)
short_description = RichTextField(features=RICHTEXTFIELD_INLINE_FEATURE_SET)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
# class Project(index.Indexed, models.Model):
# title = models.CharField(max_length=250)
# short_description = RichTextField(features=RICHTEXTFIELD_INLINE_FEATURE_SET)
# created_at = models.DateTimeField(auto_now_add=True)
# updated_at = models.DateTimeField(auto_now=True)
body = StreamField([
('heading', HeadingBlock()),
('paragraph', blocks.RichTextBlock()),
('quote', blocks.BlockQuoteBlock()),
('quotesnippet', SnippetChooserBlock(Quote)),
('datablock', blocks.StreamBlock([
('datarow', DataBlock()),
('dataheader', blocks.CharBlock()
)], icon='table', template='projects/blocks/datablock.html')),
('plan', ImageChooserBlock()),
('picture', ImageChooserBlock()),
('gallery', blocks.StreamBlock([
('plan', ImageChooserBlock()),
('picture', ImageChooserBlock())
]))
])
# body = StreamField([
# ('heading', HeadingBlock()),
# ('paragraph', blocks.RichTextBlock()),
# ('quote', blocks.BlockQuoteBlock()),
# ('quotesnippet', SnippetChooserBlock(Quote)),
# ('datablock', blocks.StreamBlock([
# ('datarow', DataBlock()),
# ('dataheader', blocks.CharBlock()
# )], icon='table', template='projects/blocks/datablock.html')),
# ('plan', ImageChooserBlock()),
# ('picture', ImageChooserBlock()),
# ('gallery', blocks.StreamBlock([
# ('plan', ImageChooserBlock()),
# ('picture', ImageChooserBlock())
# ]))
# ])
search_fields = [
index.SearchField('title'),
index.SearchField('short_description'),
index.SearchField('body'),
]
panels = [
FieldPanel('title'),
FieldPanel('location'),
FieldPanel('short_description'),
StreamFieldPanel('body')
]
def __str__ (self):
if self.updated_at:
return '{} ({} last edit: {})'.format(self.title, self.created_at.strftime('%d-%m-%Y'), self.updated_at.strftime('%d-%m-%Y'))
else:
return '{} ({})'.format(self.title, self.created_at.strftime('%d-%m-%Y'))
# search_fields = [
# index.SearchField('title'),
# index.SearchField('short_description'),
# index.SearchField('body'),
# ]
# panels = [
# FieldPanel('title'),
# FieldPanel('location'),
# FieldPanel('short_description'),
# StreamFieldPanel('body')
# ]
# def __str__ (self):
# if self.updated_at:
# return '{} ({} last edit: {})'.format(self.title, self.created_at.strftime('%d-%m-%Y'), self.updated_at.strftime('%d-%m-%Y'))
# else:
# return '{} ({})'.format(self.title, self.created_at.strftime('%d-%m-%Y'))
class ProjectBaseBlock (blocks.StructBlock):
name = blocks.CharBlock(required=False, help_text="Not displayed, used internally")
on_home = blocks.BooleanBlock(help_text="Defines whether this block be displayed on the homepage. Only the first 'homepage' block will be visible.")
on_list = blocks.BooleanBlock(help_text="Defines whether this block be displayed on the project listing page.")
on_detail = blocks.BooleanBlock(help_text="Defines whether this block will be displayed on the project detail page.")
on_home = blocks.BooleanBlock(required=False, help_text="Defines whether this block be displayed on the homepage. Only the first 'homepage' block will be visible.")
on_list = blocks.BooleanBlock(required=False, help_text="Defines whether this block be displayed on the project listing page.")
on_detail = blocks.BooleanBlock(required=False, help_text="Defines whether this block will be displayed on the project detail page.")
class ProjectImageBlock (ProjectBaseBlock):
......@@ -207,6 +206,9 @@ class ProjectStreamBlock (ProjectBaseBlock):
('datablock', ProjectStreamDataBlock()),
])
panels = [ StreamFieldPanel('body') ]
class ProjectPage(Page):
# location = models.CharField(max_length=250, blank=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment