Skip to content

Commit

Permalink
Add ordering to Item
Browse files Browse the repository at this point in the history
  • Loading branch information
robgolding committed Mar 9, 2011
1 parent c01613b commit b8f4451
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions backtrac/apps/catalog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __unicode__(self):
return self.path

class Meta:
ordering = ['name']
unique_together = (
('client', 'path'),
('parent', 'name'),
Expand Down
7 changes: 4 additions & 3 deletions backtrac/apps/catalog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def browse_directory(request, client, item,
else:
items = items.filter(parent=item)

items = items.select_related('client', 'latest_version')
items = items.select_related('client', 'latest_version').order_by('name')
events = Event.objects.filter(item__client=client).select_related()[:10]

data = {
Expand Down Expand Up @@ -109,9 +109,10 @@ def download_version(request, version_id, view_file=True):
response['Content-Transfer-Encoding'] = 'binary'
response['Content-Type'] = 'text/plain'
else:
response['Content-Disposition'] = 'attachment; filename=%s' % item.name
response['Content-Disposition'] = '%sfilename=%s' % \
('attachment; ' if not view_file else '', item.name)
response['Content-Length'] = len(contents)
response['Content-Type'] = 'application/octet-stream'
response['Content-Type'] = mimetype

return response

Expand Down

0 comments on commit b8f4451

Please sign in to comment.