# Path: privagal/core/mixins.py
# class AuthTokenPageMixin(object):
# 
#     def serve_password_required_response(self, request, form, action_url):
#         if not request.user.is_staff and settings.PRIVAGAL_AUTH_TOKEN_REQUIRED:
#             return TemplateResponse(request, 'token_required.html')
# 
#         return super(AuthTokenPageMixin, self).serve_password_required_response(
#             request, form, action_url)


import os
import zipfile
from django.conf import settings
from django.db import models, transaction
from django.template import loader
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailcore.models import PAGE_TEMPLATE_VAR, Orderable, Page
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from modelcluster.fields import ParentalKey
from sendfile import sendfile
from privagal.core.mixins import AuthTokenPageMixin
# -*- coding: utf-8 -*-
from __future__ import unicode_literals







class Gallery(AuthTokenPageMixin, Page):
    date = models.DateField("Post date", default=timezone.now)
    body = RichTextField(blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('date'),
        FieldPanel('body', classname="full"),
        InlinePanel('images', label=_('Images')),
    ]


# Path: privagal/core/mixins.py
# class AuthTokenPageMixin(object):
# 
#     def serve_password_required_response(self, request, form, action_url):
#         if not request.user.is_staff and settings.PRIVAGAL_AUTH_TOKEN_REQUIRED:
#             return TemplateResponse(request, 'token_required.html')
# 
#         return super(AuthTokenPageMixin, self).serve_password_required_response(
#             request, form, action_url)


# Path: privagal/gallery/models.py
import os
import zipfile
from django.conf import settings
from django.db import models, transaction
from django.template import loader
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailcore.models import PAGE_TEMPLATE_VAR, Orderable, Page
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from modelcluster.fields import ParentalKey
from sendfile import sendfile
from privagal.core.mixins import AuthTokenPageMixin

# -*- coding: utf-8 -*-
from __future__ import unicode_literals







class Gallery(AuthTokenPageMixin, Page):
    date = models.DateField("Post date", default=timezone.now)
    body = RichTextField(blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('date'),
        FieldPanel('body', classname="full"),
        InlinePanel('images', label=_('Images')),
    ]


    parent_page_types = ['timeline.Timeline']