diff options
Diffstat (limited to 'pgcommitfest/commitfest')
-rw-r--r-- | pgcommitfest/commitfest/models.py | 1 | ||||
-rw-r--r-- | pgcommitfest/commitfest/templates/home.html | 8 | ||||
-rw-r--r-- | pgcommitfest/commitfest/templates/patchsearch.html | 28 | ||||
-rw-r--r-- | pgcommitfest/commitfest/views.py | 14 |
4 files changed, 51 insertions, 0 deletions
diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py index 39e2d34..284c3d5 100644 --- a/pgcommitfest/commitfest/models.py +++ b/pgcommitfest/commitfest/models.py @@ -168,6 +168,7 @@ class PatchOnCommitFest(models.Model): class Meta: unique_together = (('patch', 'commitfest',),) + ordering = ('-commitfest__startdate', ) class PatchHistory(models.Model): patch = models.ForeignKey(Patch, blank=False, null=False) diff --git a/pgcommitfest/commitfest/templates/home.html b/pgcommitfest/commitfest/templates/home.html index 522ae0a..461bc28 100644 --- a/pgcommitfest/commitfest/templates/home.html +++ b/pgcommitfest/commitfest/templates/home.html @@ -10,4 +10,12 @@ The following commitfests exist in the system. <li><a href="/{{c.id}}/">{{c}}</a> ({{c.statusstring}})</li> {%endfor%} </ul> +<br/> +<h3>Commands</h3> +<form method="GET" action="/https/git.postgresql.org/search/" class="form-inline" role="form"> + <div class="form-group"> + <input type="text" class="form-control" id="searchterm" name="searchterm" placeholder="Global search"> + </div> + <button type="submit" class="btn btn-default">Search</button> +</form> {%endblock%} diff --git a/pgcommitfest/commitfest/templates/patchsearch.html b/pgcommitfest/commitfest/templates/patchsearch.html new file mode 100644 index 0000000..4db2949 --- /dev/null +++ b/pgcommitfest/commitfest/templates/patchsearch.html @@ -0,0 +1,28 @@ +{%extends "base.html"%} +{%load commitfest %} +{%block contents%} + +<table class="table table-striped table-bordered table-hover table-condensed"> + <thead> + <tr> + <th>Patch</th> + <th>Status</th> + <th>Author</th> + </tr> + </thead> + <tbody> +{%for p in patches %} + {%with p.patchoncommitfest_set.all as cfs %} + <tr> + <td>{%with cfs|first as firstcf%}<a href="/{{firstcf.commitfest_id}}/{{p.id}}/">{{p}}</a>{%endwith%}</td> + <td>{%for c in cfs %} + <div style="margin-bottom: 3px;">{{c.commitfest}}: <span class="label label-default">{{c.statusstring}}</span></div> + {%endfor%}</td> + <td>{{p.author_names|default:''}}</td> + </tr> + {%endwith%} +{%endfor%} + </tbody> +</table> + +{%endblock%} diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index a7d7498..9abf91e 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -106,6 +106,20 @@ def commitfest(request, cfid): 'openpatchids': [p.id for p in patches if p.is_open], }, context_instance=RequestContext(request)) +def global_search(request): + if not request.GET.has_key('searchterm'): + print request.GET.keys() + return HttpResponseRedirect('/') + searchterm = request.GET['searchterm'] + + patches = Patch.objects.select_related().filter(name__icontains=searchterm).order_by('created',) + + print patches + return render_to_response('patchsearch.html', { + 'patches': patches, + 'title': 'Patch search results', + }, context_instance=RequestContext(request)) + def patch(request, cfid, patchid): cf = get_object_or_404(CommitFest, pk=cfid) patch = get_object_or_404(Patch.objects.select_related(), pk=patchid, commitfests=cf) |