From da662ca57c22e0b24a6e3c2374c74dafdfab18e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Aguirre?= Date: Sat, 10 Dec 2016 17:28:32 -0300 Subject: [PATCH] Port of #905 by webjunkie --- CHANGELOG.md | 2 ++ social_django/strategy.py | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce819782..585aeddd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/social_django/strategy.py b/social_django/strategy.py index 716dac70..e7e43e3d 100644 --- a/social_django/strategy.py +++ b/social_django/strategy.py @@ -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 @@ -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):