|
@@ -197,17 +197,22 @@ class Contrib(models.Model):
|
|
|
else:
|
|
|
return None
|
|
|
|
|
|
- def get_absolute_url(self, request=None):
|
|
|
+ def get_absolute_url(self, request=None, base_url=None):
|
|
|
""" Get absolute url
|
|
|
|
|
|
- :type param: request
|
|
|
- :param: if mentioned, will be used to provide a full URL (starting with
|
|
|
- "http://" or "https://")
|
|
|
+ You can mention either `request` or `base_url` to get a full URL
|
|
|
+ (starting with "http://" or "https://")
|
|
|
+
|
|
|
+ :type request: request
|
|
|
+ :param request: if mentioned, will be used to provide a full URL
|
|
|
+ :param base_url: if mentioned, will be used to provide a full URL
|
|
|
"""
|
|
|
url = '{}#{}'.format(
|
|
|
reverse('display_map'), self.pk)
|
|
|
if request:
|
|
|
return request.build_absolute_uri(url)
|
|
|
+ elif base_url:
|
|
|
+ return '{}{}'.format(base_url, url)
|
|
|
else:
|
|
|
return url
|
|
|
|