Ejemplo n.º 1
0
from apps.managers.challenge_mgr import challenge_mgr

from apps.managers.score_mgr.models import ScoreSetting, ScoreboardEntry, PointsTransaction


class PointsTransactionAdmin(admin.ModelAdmin):
    """PointsTransaction administrator interface definition."""
    list_display = ["user", "transaction_date", "points", "message"]

admin.site.register(PointsTransaction, PointsTransactionAdmin)


class ScoreboardEntryAdmin(admin.ModelAdmin):
    """PointsTransaction administrator interface definition."""
    list_display = ["round_name", "profile", "points", "last_awarded_submission"]

admin.site.register(ScoreboardEntry, ScoreboardEntryAdmin)


class ScoreSettingAdmin(admin.ModelAdmin):
    """PointsTransaction administrator interface definition."""
    list_display = ["setup_points", "referral_bonus_points", "active_threshold_points",
                    "signup_bonus_points", "noshow_penalty_points", "feedback_bonus_points", ]

admin.site.register(ScoreSetting, ScoreSettingAdmin)


challenge_mgr.register_site_admin_model("Challenge", ScoreSetting)
challenge_mgr.register_sys_admin_model("Logs", PointsTransaction)
challenge_mgr.register_sys_admin_model("Logs", ScoreboardEntry)
Ejemplo n.º 2
0
    prepopulated_fields = {"slug": ("name",)}

admin.site.register(Group, GroupAdmin)


class TeamAdmin(admin.ModelAdmin):
    """Category Admin"""
    prepopulated_fields = {"slug": ("name",)}

admin.site.register(Team, TeamAdmin)


class PostAdmin(admin.ModelAdmin):
    """Post administrator for teams, overrides delete_selected"""
    list_filter = ["style_class", "team"]
    actions = ["delete_selected"]

    def delete_selected(self, request, queryset):
        """delete selected override"""
        _ = request
        for obj in queryset:
            obj.delete()

    delete_selected.short_description = "Delete the selected objects."

admin.site.register(Post, PostAdmin)

challenge_mgr.register_site_admin_model("Players", Group)
challenge_mgr.register_site_admin_model("Players", Team)
challenge_mgr.register_site_admin_model("Players", Post)
Ejemplo n.º 3
0
        for obj in queryset:
            obj.is_active = True
            obj.save()
    set_active.short_description = "Activate the selected users."

    def set_inactive(self, request, queryset):
        """set the active flag priority."""
        _ = request
        for obj in queryset:
            obj.is_active = False
            obj.save()
    set_inactive.short_description = "Deactivate the selected users."

    def team(self, obj):
        """return the user name."""
        return obj.get_profile().team
    team.short_description = 'Team'

    def profile(self, obj):
        """return the user profile."""
        return '<a href="%s/%d/">%s</a>' % ("/admin/player_mgr/profile",
                                           obj.get_profile().pk,
                                           obj.get_profile().name)
    profile.allow_tags = True
    profile.short_description = 'Link to Profile'


admin.site.unregister(User)
admin.site.register(User, MakahikiUserAdmin)
challenge_mgr.register_site_admin_model("Players", User)
Ejemplo n.º 4
0
                   ("email_host", "email_port", "email_use_tls"), )}),
        ("Landing Page",
             {"fields":
                  ("landing_slogan",
                   "landing_introduction",
                   "landing_participant_text",
                   "landing_non_participant_text", )}),
        ("About Page",
            {"fields":
                  ("about_page_text", )}),
    )

    inlines = [SponsorsInline]

    formfield_overrides = {
        models.TextField: {'widget': Textarea(attrs={'rows': 2, 'cols': 70})},
        }

admin.site.register(ChallengeSetting, ChallengeSettingAdmin)
admin.site.register(UploadImage)

challenge_mgr.register_site_admin_model("Challenge", ChallengeSetting)
challenge_mgr.register_site_admin_model("Challenge", RoundSetting)
challenge_mgr.register_sys_admin_model("Other Settings", PageInfo)
challenge_mgr.register_sys_admin_model("Other Settings", GameInfo)

from djcelery.models import CrontabSchedule, PeriodicTask, IntervalSchedule
challenge_mgr.register_sys_admin_model("Celery Scheduler", CrontabSchedule)
challenge_mgr.register_sys_admin_model("Celery Scheduler", IntervalSchedule)
challenge_mgr.register_sys_admin_model("Celery Scheduler", PeriodicTask)