Adds admin and migration for GroupMember conditions

This commit is contained in:
Christopher Neugebauer 2016-09-05 10:48:38 +10:00
parent 0f488e7a12
commit 1214b23077
2 changed files with 62 additions and 0 deletions

View file

@ -97,6 +97,19 @@ class SpeakerDiscountAdmin(admin.ModelAdmin, EffectsDisplayMixin):
]
@admin.register(conditions.GroupMemberDiscount)
class GroupMemberDiscountAdmin(admin.ModelAdmin, EffectsDisplayMixin):
fields = ("description", "group")
list_display = ("description", "effects")
inlines = [
DiscountForProductInline,
DiscountForCategoryInline,
]
# Vouchers
class VoucherDiscountInline(nested_admin.NestedStackedInline):
@ -194,3 +207,11 @@ class SpeakerFlagAdmin(nested_admin.NestedAdmin, EffectsDisplayMixin):
list_display = ("description", "is_presenter", "is_copresenter", "effects")
ordering = ("-is_presenter", "-is_copresenter")
@admin.register(conditions.GroupMemberFlag)
class GroupMemberFlagAdmin(admin.ModelAdmin, EffectsDisplayMixin):
fields = ("description", "group")
list_display = ("description", "effects")

View file

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-09-04 23:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0007_alter_validators_add_error_messages'),
('registrasion', '0003_auto_20160904_0235'),
]
operations = [
migrations.CreateModel(
name='GroupMemberDiscount',
fields=[
('discountbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registrasion.DiscountBase')),
('group', models.ManyToManyField(help_text='The groups a user needs to be a member of for thiscondition to be met.', to='auth.Group')),
],
options={
'verbose_name': 'discount (group member)',
'verbose_name_plural': 'discounts (group member)',
},
bases=('registrasion.discountbase', models.Model),
),
migrations.CreateModel(
name='GroupMemberFlag',
fields=[
('flagbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registrasion.FlagBase')),
('group', models.ManyToManyField(help_text='The groups a user needs to be a member of for thiscondition to be met.', to='auth.Group')),
],
options={
'verbose_name': 'flag (group member)',
'verbose_name_plural': 'flags (group member)',
},
bases=('registrasion.flagbase', models.Model),
),
]