agateblue / django-navutils

A lightweight package for handling menus and breadcrumbs in your django project
BSD 3-Clause "New" or "Revised" License
40 stars 12 forks source link

Adopt reverse notation for pattern_name #17

Open tboulogne opened 5 years ago

tboulogne commented 5 years ago

Hello,

As discuss, my proposition to adopt reverse notation for pattern_name.

Notation could be now:

without parameter pattern_name=['prestashop_connect:pads']

with parameter pattern_name=['products_manager:products_filtered', ['COM']]

This last generate : image

Hope it could help.

Regards,

Thierry

agateblue commented 5 years ago

@tboulogne unfortunately, we cannot simply remove the reverse_kwargs argument or change the argument structure, because it would break backward compatibility for existing users of this library.

However, we could support a reverse_args argument to achieve a similar result, without breaking compat? e.g when reverse_args is provided, use that instead?

tboulogne commented 5 years ago

@EliotBerriot : ok, let's do it this way :

reverse_args = ['namespace:name', [args]]
agateblue commented 5 years ago

@tboulogne if you already know the args and pattern, isn't it possible to directly call Node(url=reverse('namespace:name', args=['yourarg']))?

tboulogne commented 5 years ago

Previously i tried this way. But get errors. I found that if i manage reverse into navutils, works better :-). So i study the way you manage reverse and args...