Added reviews to the dashboard index view

This commit is contained in:
Correl Roush 2010-12-14 17:55:30 -05:00
parent 95ff757050
commit 9213ecbf54
2 changed files with 26 additions and 0 deletions

View file

@ -2,13 +2,16 @@ from django.shortcuts import render_to_response
from django.template import RequestContext from django.template import RequestContext
from django.contrib.auth.decorators import permission_required from django.contrib.auth.decorators import permission_required
from codereview.dashboard.models import Repository from codereview.dashboard.models import Repository
from codereview.review.models import Review
@permission_required('dashboard.browse') @permission_required('dashboard.browse')
def index(request): def index(request):
""" List available repositories """ List available repositories
""" """
repositories = Repository.objects.all() repositories = Repository.objects.all()
reviews = Review.objects.all().order_by('-created')
data = RequestContext(request, { data = RequestContext(request, {
'repositories': repositories, 'repositories': repositories,
'reviews': reviews,
}) })
return render_to_response('dashboard/index.html', data) return render_to_response('dashboard/index.html', data)

View file

@ -9,3 +9,26 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %} {% endblock %}
{% block content %}
<div class="section">
<h2>Reviews</h2>
<table class="reviews">
<tr>
<th>Review</th>
<th>Created</th>
<th>Comments</th>
</tr>
{% for review in reviews %}
<tr>
<td>
#{{ review.pk }} -
<a href="{% url codereview.review.views.edit review_id=review.pk %}">{{ review.description }}</a>
</td>
<td>{{ review.created }}</td>
<td>{{ review.comment_set.count }}</td>
</tr>
{% endfor %}
</ul>
</div>
{% endblock %}