-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenHub: /openhub shows how to get OH_TOKEN if not set
/openhub now shows a short message on how to get an OH_TOKEN if it's not set Closes #201
- Loading branch information
Showing
2 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
from django.shortcuts import render | ||
|
||
from openhub.models import PortfolioProject | ||
from openhub.oh_token import OH_TOKEN | ||
|
||
|
||
def index(request): | ||
projects = PortfolioProject.objects.all() | ||
args = {'projects': projects} | ||
errors = [] | ||
projects = [] | ||
if OH_TOKEN is None: | ||
errors.append(""" | ||
OH_TOKEN is not specified as an environment variable. <br/> | ||
You can get an OpenHub token by signing up at | ||
<a href="https://www.openhub.net">openhub.net</a>. | ||
""") | ||
else: | ||
projects = PortfolioProject.objects.all() | ||
|
||
args = {'projects': projects, 'errors': errors} | ||
return render(request, 'openhub.html', args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters