Last active
June 25, 2019 21:49
-
-
Save kevinhowbrook/823dc2732aa6a42084b8ec281c088307 to your computer and use it in GitHub Desktop.
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
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