Alias unified job template search fields for presentation

The polymorphic accessors have a name that is different than our
normal presentation name for these types. This aliases them for the
presentation layer and then handles processing them when they are
given as filters.
This commit is contained in:
Matthew Jones
2017-02-22 15:33:47 -05:00
parent a484dae41a
commit b14336bdff
3 changed files with 22 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
import pytest
from django.core.urlresolvers import reverse
@pytest.mark.django_db
def test_aliased_forward_reverse_field_searches(instance, options, get, admin):
url = reverse('api:unified_job_template_list')
response = options(url, None, admin)
assert 'job_template__search' in response.data['related_search_fields']
get(reverse("api:unified_job_template_list") + "?job_template__search=anything", user=admin, expect=200)