On 04 Jun 22:18, Cédric Krier wrote:
> Hi,
> 
> While watching a little bit same Odoo presentations, I saw that they
> have 2 route converters that instanciate records base on id in the url.
> So here is a patch that implements the same for flask-tryton:
> https://code.google.com/p/flask-tryton/issues/detail?id=1


A question was raised about using something else then the id.
I answered there are too few cases to be relevant but I think being able
to do slug will be a good improvement.
I think it is already doable like this:


    @app.route('/user/<record("res.user"):user>/<slug>')
    @app.route('/user/<record("res.user"):user>')
    def user(user, slug=None):
        …

The problem is to manage url_for, of course this will work:

    url_for('user', user=admin)
    url_for('user', user=admin, slug=slugify(user.name))

But I find having to pass the slug value not great because you have to
do it always with the same value.
So is there anyone who has an idea how to handle it?

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Attachment: pgpk4GSFaE7n0.pgp
Description: PGP signature

Reply via email to