Skip to content

Commit

Permalink
fix #41
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosardinepi committed Jan 7, 2017
1 parent e054793 commit d0cfa00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 1 addition & 3 deletions items/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def item_detail(request, item_pk=None):
user = None
if request.user.is_authenticated():
user = request.user.pk
items = sorted(models.Item.objects.filter(user=user),
key=lambda item: item.name.lower()
)
items = sorted(models.Item.objects.filter(user=user), key=lambda item: item.name.lower())
if item_pk:
this_item = get_object_or_404(models.Item, pk=item_pk)
if this_item.user == request.user:
Expand Down
7 changes: 2 additions & 5 deletions locations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@

@login_required
def location_detail(request, world_pk=None, location_pk=None):
worlds = sorted(models.World.objects.filter(user=request.user), key=lambda world: world.name)
worlds = sorted(models.World.objects.filter(user=request.user), key=lambda world: world.name.lower())
locations = []
for world in worlds:
locations.append(sorted(
models.Location.objects.filter(world=world),
key=lambda location: location.name.lower()
))
locations.append(sorted(models.Location.objects.filter(world=world), key=lambda location: location.name.lower()))
locations = [item for sublist in locations for item in sublist]

if world_pk:
Expand Down

0 comments on commit d0cfa00

Please sign in to comment.