Skip to content

Instantly share code, notes, and snippets.

@kevinhowbrook
Last active June 25, 2019 21:49
Show Gist options
  • Save kevinhowbrook/823dc2732aa6a42084b8ec281c088307 to your computer and use it in GitHub Desktop.
Save kevinhowbrook/823dc2732aa6a42084b8ec281c088307 to your computer and use it in GitHub Desktop.
from django.db import models
from wagtail.core.models import Page
from wagtail.admin.edit_handlers import FieldPanel
class HomePage(Page):
publication_date = models.DateTimeField(null=True, blank=True)
updated_date = models.DateTimeField("Modified date", blank=True, null=True)
content_panels = Page.content_panels + [
FieldPanel("publication_date"),
FieldPanel("updated_date"),
]
def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)
my_info = {
"username": request.user.username,
"page_title": self.title,
"fbi_agent": "Fox Mulder",
}
context.update(my_info=my_info)
return context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment