File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
from django .shortcuts import render
2
2
3
3
from openhub .models import PortfolioProject
4
+ from openhub .oh_token import OH_TOKEN
4
5
5
6
6
7
def index (request ):
7
- projects = PortfolioProject .objects .all ()
8
- args = {'projects' : projects }
8
+ errors = []
9
+ projects = []
10
+ if OH_TOKEN is None :
11
+ errors .append ("""
12
+ OH_TOKEN is not specified as an environment variable. <br/>
13
+ You can get an OpenHub token by signing up at
14
+ <a href="https://www.openhub.net">openhub.net</a>.
15
+ """ )
16
+ else :
17
+ projects = PortfolioProject .objects .all ()
18
+
19
+ args = {'projects' : projects , 'errors' : errors }
9
20
return render (request , 'openhub.html' , args )
Original file line number Diff line number Diff line change 10
10
</ head >
11
11
< body >
12
12
< h1 > All of our Portfolio Projects</ h1 >
13
+ {% for error in errors %}
14
+ < p > {{ error | safe }}</ p >
15
+ {% endfor %}
16
+
13
17
{% for project in projects %}
14
18
< div class ="container ">
15
19
< div class ="row ">
You can’t perform that action at this time.
0 commit comments