7
This repository has been archived on 2023-05-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cavemanon-wagtail-personali…/src/wagtail_personalisation/admin.py
2019-03-15 11:50:34 +01:00

45 lines
1.1 KiB
Python

from django.contrib import admin
from wagtail_personalisation import models, rules
class UserIsLoggedInRuleAdminInline(admin.TabularInline):
"""Inline the UserIsLoggedIn Rule into the
administration interface for segments.
"""
model = rules.UserIsLoggedInRule
class TimeRuleAdminInline(admin.TabularInline):
"""Inline the Time Rule into the
administration interface for segments.
"""
model = rules.TimeRule
class ReferralRuleAdminInline(admin.TabularInline):
"""Inline the Referral Rule into the
administration interface for segments.
"""
model = rules.ReferralRule
class VisitCountRuleAdminInline(admin.TabularInline):
"""Inline the Visit Count Rule into the
administration interface for segments.
"""
model = rules.VisitCountRule
class SegmentAdmin(admin.ModelAdmin):
"""Add the inline models to the Segment admin interface."""
inlines = (UserIsLoggedInRuleAdminInline, TimeRuleAdminInline,
ReferralRuleAdminInline, VisitCountRuleAdminInline)
admin.site.register(models.Segment, SegmentAdmin)