diff options
author | Dusty Phillips <buchuki@gmail.com> | 2008-10-11 19:50:08 -0400 |
---|---|---|
committer | Dusty Phillips <buchuki@gmail.com> | 2008-10-11 19:50:08 -0400 |
commit | 7dedeeafd5b2e34f05bd75e548ca56942919c668 (patch) | |
tree | 57a9310a4f540772a93a7dcbc80cff0e1384d08d | |
parent | f260843deb371a7d2ef5a265f52e643fcf64f86f (diff) |
simplify both look and code for dashboard
-rw-r--r-- | devel/views.py | 24 | ||||
-rw-r--r-- | main/models.py | 4 | ||||
-rw-r--r-- | templates/devel/index.html | 47 | ||||
-rw-r--r-- | templates/devel/siteindex.html | 1 |
4 files changed, 37 insertions, 39 deletions
diff --git a/devel/views.py b/devel/views.py index 64d1531f..e01d475c 100644 --- a/devel/views.py +++ b/devel/views.py @@ -1,26 +1,24 @@ from django import forms from django.http import HttpResponseRedirect from django.contrib.auth.models import User +from django.shortcuts import render_to_response +from django.template import RequestContext from archweb_dev.main.models import Package, Todolist from archweb_dev.main.models import Arch, Repo from archweb_dev.main.models import UserProfile, News def index(request): '''the Developer dashboard''' - todos = Todolist.objects.get_incomplete() - pkgs = Package.objects.filter( - maintainer=request.user).filter( - needupdate=True).order_by('repo', 'pkgname') - - return render_to_response( - 'devel/index.html', - RequestContext(request, {'pkgs': pkgs, 'todos': todos, - 'maint': request.user, + page_dict = { + 'todos': Todolist.objects.incomplete(), 'repos': Repo.objects.all(), 'arches': Arch.objects.all(), - 'maintainers': - [User(id=0, username="orphan", first_name="Orphans")] + list( - User.objects.all()) - })) + 'maintainers': [ + User(id=0, username="orphan", first_name="Orphans") + ] + list(User.objects.all()) + } + + return render_to_response('devel/index.html', + RequestContext(request, page_dict)) def change_notify(request): maint = User.objects.get(username=request.user.username) diff --git a/main/models.py b/main/models.py index 663ea11e..c62ac206 100644 --- a/main/models.py +++ b/main/models.py @@ -40,7 +40,7 @@ class UserProfile(models.Model): ### Manager Classes ### ####################### class TodolistManager(models.Manager): - def get_incomplete(self): + def incomplete(self): return self.filter(todolistpkg__complete=False).distinct() class PackageManager(models.Manager): @@ -237,7 +237,7 @@ class PackageDepend(models.Model): class Todolist(models.Model): id = models.AutoField(primary_key=True) - creator = models.ForeignKey(User, related_name='todolist_creator') + creator = models.ForeignKey(User) name = models.CharField(max_length=255) description = models.TextField() date_added = models.DateField(auto_now_add=True) diff --git a/templates/devel/index.html b/templates/devel/index.html index 661db3c0..f3c6d463 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -78,32 +78,31 @@ </div> <br /><br /> - <div class="box"> - <h3 class="title">Package Maintenance</h3> + <div class="greybox"> + <h3 class="title">My Flagged Packages</h3> + <form method="post" action="/devel/notify/"> + <input name="notify" type="checkbox" value="yes" + {% if user.get_profile.notify %} checked="checked"{% endif %} /> + Notify me when packages are flagged + <input type="submit" value="Update" /> + </form> <br /> - <table width="100%"> + <table class="results" width="100%"> <tr> - <td style="vertical-align: top"> - <br /> - <a - href="http://wiki.archlinux.org/index.php/DeveloperWiki:HOWTO_Be_A_Packager">Package Maintainer's Guide</a><br /> - </td><td style="vertical-align: top"> - {% if pkgs %} - <h4>My Flagged Packages:</h4> - <ul class="small"> - <li><form method="post" action="/devel/notify/"> - <input name="notify" type="checkbox" value="yes"{% if maint.get_profile.notify %} checked{% endif %} /> Notify me when packages are flagged - - <input type="submit" value="Update" /> - </form></li> - </ul> - <ul class="small"> - {% for pkg in pkgs %} - <li><a href="/packages/{{ pkg.id }}/">{{ pkg.repo.name }}::{{ pkg.pkgname }} {{ pkg.pkgver }} {{ pkg.arch.name }}</a></li> - {% endfor %} - </ul> - {% endif %} - </td> + <th style="width: 50%">Name</th> + <th>Repo</th> + <th>Version</th> + <th>Arch</th> </tr> + {% for pkg in user.maintained_packages.flagged %} + <tr class="{% cycle pkgr2,pkgr1 %}"> + <td> + <a href="/packages/{{ pkg.id }}/">{{ pkg.pkgname }}</a> + </td> + <td>{{ pkg.pkgver }}</td> + <td>{{ pkg.repo.name }}</td> + <td>{{ pkg.arch.name }}</td> + </tr> + {% endfor %} </table> {% endblock %} diff --git a/templates/devel/siteindex.html b/templates/devel/siteindex.html index 94ef405d..27a5b515 100644 --- a/templates/devel/siteindex.html +++ b/templates/devel/siteindex.html @@ -46,6 +46,7 @@ <li><a href="/packages/signoffs/">Signoffs</a></li> <li><a href="/todo/">Todos</a></li> <li><a href="http://www.archlinux.org/mailman/private/arch-dev/">Archives</a></li> + <li><a href="http://wiki.archlinux.org/index.php/DeveloperWiki:HOWTO_Be_A_Packager">Package Maintainer's Guide</a></li> <li><a href="/devel/profile/">Profile</a></li> </ul> <h3>Main Site Links:</h3> |