Skip to content

Commit

Permalink
path.split('/') IndexError fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex committed Nov 13, 2015
1 parent e6c9e6a commit 116590e
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 115 deletions.
5 changes: 4 additions & 1 deletion mptt_urls/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ def __call__(self, *args, **kwargs):

instance = None # actual instance the path is pointing to (None by default)
path = kwargs['path']
instance_slug = path.split('/')[-2] # slug of the instance
try:
instance_slug = path.split('/')[-2] # slug of the instance
except IndexError:
instance_slug = None

if instance_slug:
candidates = self.model.objects.filter(**{self.slug_field: instance_slug}) # candidates to be the instance
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='django-mptt-urls',
version='2.0.2',
version='2.0.3',
packages=find_packages(),
include_package_data=True,
install_requires=['django>=1.7', 'django-mptt>=0.6.1'],
Expand Down
Binary file modified test_project/db.sqlite3
Binary file not shown.
69 changes: 0 additions & 69 deletions test_project/gallery/migrations/0001_initial.py

This file was deleted.

This file was deleted.

Empty file.

0 comments on commit 116590e

Please sign in to comment.