meshy / django-conman

NOT READY: Work in progress. A content management system for django
BSD 2-Clause "Simplified" License
3 stars 5 forks source link

Add `Route.get_parent` #121

Open meshy opened 7 years ago

meshy commented 7 years ago

We have get_ancestors, but we can't so easily get the immediate one.

meshy commented 7 years ago

Question 1

We have only one route:

route = Route.objects.create(url='/anything/')

If we call route.get_parent(), do we get None? Would it be more sane to raise DoesNotExist?

Question 2

We have only two routes:

r1 = Route.objects.create(url='/')
r2 = Route.objects.create(url='/nested/twice/')

If we call r2.get_parent(), do we get r1?