Skip to content

Commit

Permalink
Port of #905 by webjunkie
Browse files Browse the repository at this point in the history
  • Loading branch information
omab committed Dec 10, 2016
1 parent 7c88d23 commit da662ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased](https://github.com/python-social-auth/social-app-django/commits/master)

### Added
- Let Django resolve URL when getting from settings (port of [#905](https://github.com/omab/python-social-auth/pull/905)
by webjunkie)
- Add setting to fine-tune admin search fields (port of [#1035](https://github.com/omab/python-social-auth/pull/1035)
by atugushev)

Expand Down
8 changes: 5 additions & 3 deletions social_django/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.db.models import Model
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth import authenticate
from django.shortcuts import redirect
from django.shortcuts import redirect, resolve_url
from django.template import TemplateDoesNotExist, RequestContext, loader, engines
from django.utils.encoding import force_text
from django.utils.functional import Promise
Expand Down Expand Up @@ -43,8 +43,10 @@ def __init__(self, storage, request=None, tpl=None):
def get_setting(self, name):
value = getattr(settings, name)
# Force text on URL named settings that are instance of Promise
if name.endswith('_URL') and isinstance(value, Promise):
value = force_text(value)
if name.endswith('_URL'):
if isinstance(value, Promise):
value = force_text(value)
value = resolve_url(value)
return value

def request_data(self, merge=True):
Expand Down

0 comments on commit da662ca

Please sign in to comment.