Exemplo n.º 1
0
from . import views


class LanguageModelAdmin(ModelAdmin):
    model = SiteLanguage
    menu_label = 'Language'
    menu_icon = 'doc-full-inverse'
    list_display = ('locale', 'is_main_language', 'is_active')
    search_fields = ('title',)
    list_per_page = 20
    add_to_settings_menu = True
    ordering = ('-is_main_language', 'locale')
    menu_order = 100

wagtailmodeladmin_register(LanguageModelAdmin)


@hooks.register('register_admin_urls')
def urlconf_translations():
    return [
        url(
            r'^translations/add/(?P<page_id>\d+)/(?P<locale>[\w\-\_]+)/$',
            'molo.core.views.add_translation',
            name='add_translation'),
    ]


@hooks.register('register_admin_urls')
def register_admin_urls():
    return [
        """)


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')


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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
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)
Exemplo n.º 5
0
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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)
Exemplo n.º 8
0
def whitelister_element_rules():
    return {
        'blockquote': allow_without_attributes,
        'span': allow_without_attributes
    }


@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)
Exemplo n.º 9
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)