diff --git a/passbook/core/forms/rules.py b/passbook/core/forms/rules.py index 9b179acac..a6ae9310b 100644 --- a/passbook/core/forms/rules.py +++ b/passbook/core/forms/rules.py @@ -15,7 +15,6 @@ class FieldMatcherRuleForm(forms.ModelForm): fields = GENERAL_FIELDS + ['user_field', 'match_action', 'value', ] widgets = { 'name': forms.TextInput(), - 'user_field': forms.TextInput(), 'value': forms.TextInput(), } diff --git a/passbook/core/migrations/0002_auto_20181210_1011.py b/passbook/core/migrations/0002_auto_20181210_1011.py new file mode 100644 index 000000000..176a4590b --- /dev/null +++ b/passbook/core/migrations/0002_auto_20181210_1011.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.4 on 2018-12-10 10:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_core', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='fieldmatcherrule', + name='user_field', + field=models.TextField(choices=[('username', 'username'), ('first_name', 'first_name'), ('last_name', 'last_name'), ('email', 'email'), ('is_staff', 'is_staff'), ('is_active', 'is_active'), ('data_joined', 'data_joined')]), + ), + ] diff --git a/passbook/core/models.py b/passbook/core/models.py index 4e77c807f..d86992226 100644 --- a/passbook/core/models.py +++ b/passbook/core/models.py @@ -141,7 +141,17 @@ class FieldMatcherRule(Rule): (MATCH_EXACT, _('Exact')), ) - user_field = models.TextField() + USER_FIELDS = ( + ('username', 'username',), + ('first_name', 'first_name',), + ('last_name', 'last_name',), + ('email', 'email',), + ('is_staff', 'is_staff',), + ('is_active', 'is_active',), + ('data_joined', 'data_joined',), + ) + + user_field = models.TextField(choices=USER_FIELDS) match_action = models.CharField(max_length=50, choices=MATCHES) value = models.TextField() diff --git a/passbook/core/templates/overview/base.html b/passbook/core/templates/overview/base.html index 2cc450125..39345f100 100644 --- a/passbook/core/templates/overview/base.html +++ b/passbook/core/templates/overview/base.html @@ -83,4 +83,4 @@ $().setupVerticalNavigation(true); }); -{% endblock %} \ No newline at end of file +{% endblock %}