0xE111 / django-mptt-urls

Creating hierarchical URLs in Django associated with django-MPTT models
MIT License
36 stars 5 forks source link

Specify parent field #4

Closed tomasjacobsen closed 10 years ago

tomasjacobsen commented 10 years ago

As of now, your parent field can only be named "parent". Is it possible to specify the parent field in mptt_urls settings like you can do with the slugfield?

MrKesn commented 10 years ago

I simply forgot to add this feature to docs. The code accepts different parent names: instance = getattr(instance, settings['leaf'].get('parent', 'parent'))

Try to use:

    'node': {
        'parent': '<YourNodeParentName>',
        ...
    },
    'leaf': {
        'parent': '<YourLeafParentName>',
        ...
    }

Please feedback if you have any issues.