Skip to content

Commit

Permalink
Fixes #212: Tweak APISelect widget to inject BASE_PATH in API URL
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Sep 29, 2016
1 parent 833499f commit 18a5a96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion netbox/utilities/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re

from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.core.validators import URLValidator
from django.utils.encoding import force_text
Expand Down Expand Up @@ -91,7 +92,7 @@ def __init__(self, api_url, display_field=None, disabled_indicator=None, *args,
super(APISelect, self).__init__(*args, **kwargs)

self.attrs['class'] = 'api-select'
self.attrs['api-url'] = api_url
self.attrs['api-url'] = '/{}{}'.format(settings.BASE_PATH, api_url.lstrip('/')) # Inject BASE_PATH
if display_field:
self.attrs['display-field'] = display_field
if disabled_indicator:
Expand Down

0 comments on commit 18a5a96

Please sign in to comment.