class Meta:
unique_together = (('patch', 'commitfest',),)
+ ordering = ('-commitfest__startdate', )
class PatchHistory(models.Model):
patch = models.ForeignKey(Patch, blank=False, null=False)
<li><a href="/{{c.id}}/">{{c}}</a> ({{c.statusstring}})</li>
{%endfor%}
</ul>
+<br/>
+<h3>Commands</h3>
+<form method="GET" action="/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%}
--- /dev/null
+{%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%}
'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)
url(r'^(\d+)/(\d+)/(comment|review)/', 'commitfest.views.comment'),
url(r'^(\d+)/send_email/$', 'commitfest.views.send_email'),
url(r'^(\d+)/\d+/send_email/$', 'commitfest.views.send_email'),
+ url(r'^search/$', 'commitfest.views.global_search'),
url(r'^ajax/(\w+)/$', 'commitfest.ajax.main'),
url(r'^selectable/', include('selectable.urls')),