add get_access_url property to partners and streams.
@@ -394,6 +394,17 @@ class Partner(models.Model):
return self.status == self.NOT_AVAILABLE
+ @property
+ def get_access_url(self):
+ ezproxy_url = settings.TWLIGHT_EZPROXY_URL
+ access_url = None
+ if self.authorization_method == self.PROXY and ezproxy_url and self.target_url:
+ access_url = ezproxy_url + "/login?url=" + self.target_url
+ elif self.target_url:
+ access_url = self.target_url
+ return access_url
+
+
class PartnerLogo(models.Model):
@@ -482,6 +493,17 @@ class Stream(models.Model):
return ", ".join([p.__unicode__() for p in self.languages.all()])
+ @property
+ def get_access_url(self):
+ ezproxy_url = settings.TWLIGHT_EZPROXY_URL
+ access_url = None
+ if self.authorization_method == self.PROXY and ezproxy_url and self.target_url:
+ access_url = ezproxy_url + "/login?url=" + self.target_url
+ elif self.target_url:
+ access_url = self.target_url
+ return access_url
+
+
class Contact(models.Model):
"""
