Example #1
0
from wagtailmodeladmin.options import ModelAdmin, wagtailmodeladmin_register
from .models import Message


class MessageAdmin(ModelAdmin):
    model = Message
    menu_label = 'Messages'
    menu_icon = 'date'
    menu_order = 200
    add_to_settings_menu = False
    list_display = ('contact_date', 'contacted', 'sender', 'email', 'number', 'category', 'message')
    list_filter = ('contacted', 'category', 'contact_date')
    search_fields = ('sender', 'email', 'body',)

wagtailmodeladmin_register(MessageAdmin)
    menu_icon = 'date'
    menu_order = 600
    add_to_settings_menu = False
    list_display = ('date', 'name', 'email')


class SignUpFormPageResponseModelAdmin(ModelAdmin):
    model = SignUpFormPageResponse
    menu_label = 'Sign-Up Form Page Submissions'
    menu_icon = 'date'
    menu_order = 600
    add_to_settings_menu = False
    list_display = ('date', 'email')


class SubmissionsModelAdminGroup(ModelAdminGroup):
    menu_label = 'Form Submissions'
    menu_icon = 'folder-open-inverse' # change as required
    menu_order = 600
    items = (SignUpFormPageResponseModelAdmin, GoogleAdGrantApplicationModelAdmin)

wagtailmodeladmin_register(SubmissionsModelAdminGroup)


@hooks.register('insert_global_admin_css')
def import_fontawesome_stylesheet():
    elem = '<link rel="stylesheet" href="{}torchbox/vendor/fontawesome/css/font-awesome.min.css">'.format(
        settings.STATIC_URL
    )
    return format_html(elem)
from django.conf.urls import url
from molo.commenting.admin import CommentingModelAdminGroup
from molo.commenting.admin_views import MoloCommentsAdminReplyView
from wagtail.wagtailcore import hooks
from wagtailmodeladmin.options import wagtailmodeladmin_register


@hooks.register('register_admin_urls')
def register_molo_comments_admin_reply_url():
    return [
        url(r'comment/(?P<parent>\d+)/reply/$',
            MoloCommentsAdminReplyView.as_view(),
            name='molo-comments-admin-reply'),
    ]

wagtailmodeladmin_register(CommentingModelAdminGroup)
Example #4
0
from django.conf.urls import url
from molo.polls.admin import QuestionsModelAdmin
from molo.polls.admin_views import QuestionResultsAdminView
from wagtail.wagtailcore import hooks
from wagtailmodeladmin.options import wagtailmodeladmin_register


@hooks.register('register_admin_urls')
def register_question_results_admin_view_url():
    return [
        url(r'polls/question/(?P<parent>\d+)/results/$',
            QuestionResultsAdminView.as_view(),
            name='question-results-admin'),
    ]

wagtailmodeladmin_register(QuestionsModelAdmin)
Example #5
0
    def role_and_production(self, obj): # pylint: disable=no-self-use
        if obj.production and obj.role:
            return format_html(
                '{} at <a href="{}">{}</a>',
                obj.role,
                reverse('wagtailadmin_pages:edit', args=(obj.production.id,)),
                obj.production
            )
        elif obj.production:
            return format_html(
                '<a href="{}">{}</a>',
                reverse('wagtailadmin_pages:edit', args=(obj.production.id,)),
                obj.production
            )
        elif obj.role:
            return obj.role
        else:
            return ""
    role_and_production.admin_order_field = '-production'

    def full_name(self, obj): # pylint: disable=no-self-use
        return "%s %s" % (
            obj.first_name,
            obj.last_name
        )
    full_name.short_description = 'name'
    full_name.admin_order_field = 'last_name'

wagtailmodeladmin_register(PeopleAdmin)
Example #6
0
    }


@hooks.register('insert_editor_js')
def editor_js():
    js_files = [
        'torchbox/js/hallo-plugins/span.js'
    ]
    js_includes = format_html_join(
        '\n', '<script src="{0}{1}"></script>',
        ((settings.STATIC_URL, filename) for filename in js_files)
    )
    return js_includes + format_html(
        """
        <script>
          registerHalloPlugin('spanbutton');
        </script>
        """
    )


class GoogleAdGrantApplicationModelAdmin(ModelAdmin):
    model = GoogleAdGrantApplication
    menu_label = 'Ad Grant Applications'
    menu_icon = 'date'
    menu_order = 600
    add_to_settings_menu = False
    list_display = ('date', 'name', 'email')

wagtailmodeladmin_register(GoogleAdGrantApplicationModelAdmin)