add discount percentage configuration

This commit is contained in:
Matthew Piatetsky
2019-10-22 16:40:04 -04:00
parent 6e0914ad5d
commit 86bb0cfa2c
7 changed files with 94 additions and 8 deletions

View File

@@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _
from openedx.core.djangoapps.config_model_utils.admin import StackedConfigModelAdmin
from .models import DiscountRestrictionConfig
from .models import DiscountPercentageConfig, DiscountRestrictionConfig
class DiscountRestrictionConfigAdmin(StackedConfigModelAdmin):
@@ -43,3 +43,26 @@ class DiscountRestrictionConfigAdmin(StackedConfigModelAdmin):
raw_id_fields = ('course',)
admin.site.register(DiscountRestrictionConfig, DiscountRestrictionConfigAdmin)
class DiscountPercentageConfigAdmin(StackedConfigModelAdmin):
"""
Admin to configure discount percentage
"""
fieldsets = (
('Context', {
'fields': DiscountRestrictionConfig.KEY_FIELDS,
'description': _(
'These define the context to configure the percentage for the first purchase discount.'
'If multiple contexts apply to a course (for example, if configuration '
'is specified for the course specifically, and for the org that the course '
'is in, then the more specific context overrides the more general context.'
),
}),
('Configuration', {
'fields': ('percentage',),
})
)
raw_id_fields = ('course',)
admin.site.register(DiscountPercentageConfig, DiscountPercentageConfigAdmin)