Skip to content

Commit

Permalink
add link offset field for widget APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
visiblegovernment committed May 6, 2010
1 parent f3252e1 commit d04032d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion mainapp/middleware/subdomains.py
Expand Up @@ -5,7 +5,8 @@
adds the following to the request:
- host: the HTTP_HOST preceded by http:// - used when formatting
links for outgoing emails.
- subdomain: can be used to identify a city, or a widget.
- subdomain: can be used to identify a city, eg.
toronto.fixmystreet.ca
NOTE: there may be login issues across sub-domains when user
logins are supported
Expand Down
2 changes: 1 addition & 1 deletion mainapp/middleware/widget.py
Expand Up @@ -31,7 +31,7 @@ def process_request(self, request):
request.base_template = key_entry.template

# override the host URL
request.host_url = key_entry.domain
request.host_url = key_entry.domain + key_entry.link_offset

def get_api_key(self,request):
return( request.POST.get('api_key',request.GET.get('api_key',None)) )
Expand Down
14 changes: 12 additions & 2 deletions mainapp/models.py
Expand Up @@ -633,11 +633,21 @@ class ApiKey(models.Model):
contact_email = models.EmailField(null=True,blank=True)
approved = models.BooleanField(default=False)

# the following fields are used for embedded widget
# APIs
"""---------------------------------------------
the following fields are used for embedded widget
views
---------------------------------------------"""

# top-level domain of the site using the widget
domain = models.CharField(max_length=100,null=True,blank=True)

# offset for links in confirmation emails
link_offset = models.CharField(max_length=100,null=True,blank=True)

# is this widget API specific to a city (eg. TO)
city = models.ForeignKey(City,null=True,blank=True)

# what base template do they use?
template = models.CharField(max_length=100, default='widgets/900x600.html')

def __unicode__(self):
Expand Down

0 comments on commit d04032d

Please sign in to comment.