Repo graph template
This commit is contained in:
parent
8e2decc27e
commit
57ea318fcf
3 changed files with 22 additions and 2 deletions
7
templates/graph_repo.html
Normal file
7
templates/graph_repo.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{# vim: set ft=htmldjango #}
|
||||||
|
{% extends "graph_base.html" %}
|
||||||
|
|
||||||
|
{% block graph %}
|
||||||
|
<h1 class="placeholder">PUT A GRAPH OF<br/>{{ username }}'s<br/>{{ repo }}
|
||||||
|
REPO<br/>HERE</h1>
|
||||||
|
{% endblock %}
|
|
@ -7,6 +7,9 @@
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">My Repos</a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">My Repos</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
|
{% for repo in request.user_repos %}
|
||||||
|
<li>{{ repo }}</li>
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="{% url index %}">Followers</a></li>
|
<li><a href="{% url index %}">Followers</a></li>
|
||||||
|
|
14
views.py
14
views.py
|
@ -4,6 +4,13 @@ from django.shortcuts import redirect, render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
|
||||||
|
|
||||||
|
class GitHubRequestContext(RequestContext):
|
||||||
|
@property
|
||||||
|
def user_repos(self):
|
||||||
|
username = self.request.user.username
|
||||||
|
return self.request.github.get_iter('/users/%s/repos/' % username)
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
'''Index page. Everyone starts here. If the user is logged in (that is, they
|
'''Index page. Everyone starts here. If the user is logged in (that is, they
|
||||||
have a session id) return the follower_graph view. Otherwise, render the
|
have a session id) return the follower_graph view. Otherwise, render the
|
||||||
|
@ -35,9 +42,12 @@ def login(request):
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def graph_followers(request):
|
def graph_followers(request):
|
||||||
return render_to_response('graph_followers.html', RequestContext(request))
|
return render_to_response('graph_followers.html', GitHubRequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def graph_repo(request, user, repo):
|
def graph_repo(request, user, repo):
|
||||||
return render_to_response('graph_followers.html', RequestContext(request))
|
return render_to_response('graph_repo.html', {
|
||||||
|
'username': user,
|
||||||
|
'repo': repo,
|
||||||
|
}, RequestContext(request))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue