Esempio n. 1
0

def unprivatize_sel(modeladmin, request, queryset):
    """ marks selected pastes as private. """
    selcnt = len(queryset)
    privcnt = queryset.update(private=False)
    pstr = plural(selcnt, 'paste was', 'pastes were')
    msg = '{} of {} {} marked as not private.'.format(privcnt, selcnt, pstr)
    modeladmin.message_user(request, msg, level=messages.SUCCESS)
    return privcnt


unprivatize_sel.short_description = 'Unprivatize selected pastes'


class wp_pasteAdmin(admin.ModelAdmin):  # noqa
    # enable actions above
    actions = [
        delete_sel_expired,
        disable_pastes,
        disable_sel_expired,
        enable_pastes,
        hold_sel,
        privatize_sel,
        remove_hold_sel,
        unprivatize_sel,
    ]


admin_site.register(wp_paste, wp_pasteAdmin)
Esempio n. 2
0
from django.contrib import admin
from apps.phonewords.models import pw_result
from home.admin import admin_site


def enable_results(modeladmin, request, queryset):
    """ enables results (.disabled = False) """
    queryset.update(disabled=False)


enable_results.short_description = 'Enable selected Results'


def disable_results(modeladmin, request, queryset):
    """ disables results (.disabled = True) """
    queryset.update(disabled=True)


disable_results.short_description = 'Disable selected Results'


class pw_resultAdmin(admin.ModelAdmin):
    # enable actions above
    actions = [enable_results, disable_results]


admin_site.register(pw_result, pw_resultAdmin)
Esempio n. 3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
    Welborn Productions - Downloads - Admin page
    Provides admin site for Downloads app (for things like file_tracker)

    -Christopher Welborn 5-25-2013
'''

from django.contrib import admin
from downloads.models import file_tracker
from home.admin import admin_site


class wp_downloadsAdmin(admin.ModelAdmin):
    # prepopulated_fields= {'alias': ('name'.replace(' ', '').lower(), )}
    pass


admin_site.register(file_tracker, wp_downloadsAdmin)
Esempio n. 4
0
    """ marks selected images as private. """
    selcnt = len(queryset)
    privcnt = queryset.update(private=True)
    pstr = plural(selcnt, 'image was', 'images were')
    msg = '{} of {} {} marked as private.'.format(privcnt, selcnt, pstr)
    modeladmin.message_user(request, msg, level=messages.SUCCESS)
    return privcnt


privatize_sel.short_description = 'Privatize selected images'


def unprivatize_sel(modeladmin, request, queryset):
    """ marks selected images as private. """
    selcnt = len(queryset)
    privcnt = queryset.update(private=False)
    pstr = plural(selcnt, 'image was', 'images were')
    msg = '{} of {} {} marked as not private.'.format(privcnt, selcnt, pstr)
    modeladmin.message_user(request, msg, level=messages.SUCCESS)
    return privcnt


unprivatize_sel.short_description = 'Unprivatize selected images'


class wp_imageAdmin(admin.ModelAdmin):  # noqa
    actions = [disable_sel, enable_sel, privatize_sel, unprivatize_sel]


admin_site.register(wp_image, wp_imageAdmin)
Esempio n. 5
0
from django.contrib import admin
from apps.models import wp_app
from home.admin import admin_site


def enable_apps(modeladmin, request, queryset):
    """ enables apps (.disabled = False) """
    queryset.update(disabled=False)


enable_apps.short_description = 'Enable selected Apps'


def disable_apps(modeladmin, request, queryset):
    """ disables apps (.disabled = True) """
    queryset.update(disabled=True)


disable_apps.short_description = 'Disable selected Apps'


class wp_appAdmin(admin.ModelAdmin):
    prepopulated_fields = {'alias': ('name'.replace(' ', '').lower(), )}
    # enable actions above
    actions = [enable_apps, disable_apps]


admin_site.register(wp_app, wp_appAdmin)
Esempio n. 6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''
    Welborn Productions - Downloads - Admin page
    Provides admin site for Downloads app (for things like file_tracker)

    -Christopher Welborn 5-25-2013
'''

from django.contrib import admin
from downloads.models import file_tracker
from home.admin import admin_site


class wp_downloadsAdmin(admin.ModelAdmin):
    # prepopulated_fields= {'alias': ('name'.replace(' ', '').lower(), )}
    pass


admin_site.register(file_tracker, wp_downloadsAdmin)
Esempio n. 7
0
from home.admin import admin_site


def enable_projects(modeladmin, request, queryset):
    """ enables projects (.disabled = False) """
    queryset.update(disabled=False)


enable_projects.short_description = 'Enable selected Projects'


def disable_projects(modeladmin, request, queryset):
    """ disables projects (.disabled = True) """
    queryset.update(disabled=True)


disable_projects.short_description = 'Disable selected Projects'


class wp_projectAdmin(admin.ModelAdmin):  # noqa
    prepopulated_fields = {
        'alias': ('name'.replace(' ', '').lower(),)
    }
    # enable actions above
    actions = [
        enable_projects,
        disable_projects]


admin_site.register(wp_project, wp_projectAdmin)
Esempio n. 8
0
from home.admin import admin_site

# actions for admin page


def enable_misc(modeladmin, request, queryset):
    """ enables misc (.disabled = False) """
    queryset.update(disabled=False)


enable_misc.short_description = 'Enable selected Misc. objects'


def disable_misc(modeladmin, request, queryset):
    """ disables misc (.disabled = True) """
    queryset.update(disabled=True)


disable_misc.short_description = 'Disable selected Misc. objects'


class wp_miscAdmin(admin.ModelAdmin):
    prepopulated_fields = {'alias': ('name'.replace(' ', '').lower(),)
                           }
    # enable actions above
    actions = [enable_misc,
               disable_misc]


admin_site.register(wp_misc, wp_miscAdmin)
Esempio n. 9
0
from django.contrib import admin
from apps.phonewords.models import pw_result
from home.admin import admin_site


def enable_results(modeladmin, request, queryset):
    """ enables results (.disabled = False) """
    queryset.update(disabled=False)


enable_results.short_description = 'Enable selected Results'


def disable_results(modeladmin, request, queryset):
    """ disables results (.disabled = True) """
    queryset.update(disabled=True)


disable_results.short_description = 'Disable selected Results'


class pw_resultAdmin(admin.ModelAdmin):
    # enable actions above
    actions = [enable_results,
               disable_results]


admin_site.register(pw_result, pw_resultAdmin)
Esempio n. 10
0
from django.contrib import admin
from apps.models import wp_app
from home.admin import admin_site


def enable_apps(modeladmin, request, queryset):
    """ enables apps (.disabled = False) """
    queryset.update(disabled=False)


enable_apps.short_description = 'Enable selected Apps'


def disable_apps(modeladmin, request, queryset):
    """ disables apps (.disabled = True) """
    queryset.update(disabled=True)


disable_apps.short_description = 'Disable selected Apps'


class wp_appAdmin(admin.ModelAdmin):
    prepopulated_fields = {'alias': ('name'.replace(' ', '').lower(),)
                           }
    # enable actions above
    actions = [enable_apps,
               disable_apps]


admin_site.register(wp_app, wp_appAdmin)
Esempio n. 11
0
from django.contrib import admin
from projects.models import wp_project
from home.admin import admin_site


def enable_projects(modeladmin, request, queryset):
    """ enables projects (.disabled = False) """
    queryset.update(disabled=False)


enable_projects.short_description = 'Enable selected Projects'


def disable_projects(modeladmin, request, queryset):
    """ disables projects (.disabled = True) """
    queryset.update(disabled=True)


disable_projects.short_description = 'Disable selected Projects'


class wp_projectAdmin(admin.ModelAdmin):  # noqa
    prepopulated_fields = {'alias': ('name'.replace(' ', '').lower(), )}
    # enable actions above
    actions = [enable_projects, disable_projects]


admin_site.register(wp_project, wp_projectAdmin)
Esempio n. 12
0
    queryset.update(disabled=False)


enable_posts.short_description = 'Enable selected Posts'


def disable_comments(modeladmin, request, queryset):
    """ makes .enable_comments = False on selected posts."""
    queryset.update(enable_comments=False)


disable_comments.short_description = 'Disable Comments in selected Posts'


def enable_comments(modeladmin, request, queryset):
    """ makes .enable_comments = True on selected posts."""
    queryset.update(enable_comments=True)


enable_comments.short_description = 'Enable Comments in selected Posts'


class wp_blogAdmin(admin.ModelAdmin):
    # exclude = ['posted']
    prepopulated_fields = {'slug': ('title'.lower(), )}
    # enable actions found above for this admin page.
    actions = [enable_posts, disable_posts, enable_comments, disable_comments]


admin_site.register(wp_blog, wp_blogAdmin)
Esempio n. 13
0
    modeladmin.message_user(request, msg, level=messages.SUCCESS)
    return privcnt


privatize_sel.short_description = 'Privatize selected images'


def unprivatize_sel(modeladmin, request, queryset):
    """ marks selected images as private. """
    selcnt = len(queryset)
    privcnt = queryset.update(private=False)
    pstr = plural(selcnt, 'image was', 'images were')
    msg = '{} of {} {} marked as not private.'.format(privcnt, selcnt, pstr)
    modeladmin.message_user(request, msg, level=messages.SUCCESS)
    return privcnt


unprivatize_sel.short_description = 'Unprivatize selected images'


class wp_imageAdmin(admin.ModelAdmin):  # noqa
    actions = [
        disable_sel,
        enable_sel,
        privatize_sel,
        unprivatize_sel
    ]


admin_site.register(wp_image, wp_imageAdmin)
Esempio n. 14
0
from django.contrib import admin
from solo.admin import SingletonModelAdmin


class TKAddressAdmin(admin.ModelAdmin):
    pass


class TKEmployeeAdmin(admin.ModelAdmin):
    pass


class TKJobAdmin(admin.ModelAdmin):
    pass


class TKSessionAdmin(admin.ModelAdmin):
    pass


class TKZipCodeAdmin(admin.ModelAdmin):
    pass


admin_site.register(TKConfig, SingletonModelAdmin)
admin_site.register(TKAddress, TKAddressAdmin)
admin_site.register(TKEmployee, TKEmployeeAdmin)
admin_site.register(TKJob, TKJobAdmin)
admin_site.register(TKSession, TKSessionAdmin)
admin_site.register(TKZipCode, TKZipCodeAdmin)