incorrect url for "add product variation" in admin templatetag

Create issue
Issue #1137 resolved
slowpeels created an issue

The correct URL should be /admin/configurable/productvariation/add/ and delete/

I've included a patch. Also is the TODO comment for django #7738 in this code still valid? Wasn't sure so I left it in.

Comments (6)

  1. Tay Ray Chuan


    could you inline the patch in the future? Saves me/us the trouble of downloading+opening the patch.

  2. Chris Moffitt repo owner

    Also, in looking at the patch, we should probably fix the urls so they aren't hard coded anymore. This link describes Django's syntax for doing so -

    Here's an inline of the proposed patch submitted by cra1g:

    diff -r 48722801011c satchmo/apps/product/templatetags/
    --- a/satchmo/apps/product/templatetags/	Sat May 01 14:42:56 2010 +0800
    +++ b/satchmo/apps/product/templatetags/	Mon May 03 20:14:32 2010 -0300
    @@ -66,7 +66,7 @@
             product = configurableproduct.get_product_from_options(p_opt)
             if product:
                 p_url = '/admin/product/product/%s/' %
    -            pv_url = '/admin/product/productvariation/%s/delete/' %
    +            pv_url = '/admin/configurable/productvariation/%s/delete/' %
                 output += """
    @@ -80,7 +80,7 @@
                 #opt_pks = ','.join(opt_pks)
                 # TODO [NFA]: Blocked by Django ticket #7738.
                 opt_pks = ''
    -            add_url = ('/admin/product/productvariation/add/' +
    +            add_url = ('/admin/configurable/productvariation/add/' +
                     "?product=%s&parent=%s&options=%s" % (
  3. Tay Ray Chuan

    Chris - thanks for that.

    Actually, I already downloaded and looked through the patch, and had the same thoughts as well - since we're at it, might as well use named urls.

  4. Tay Ray Chuan

    satchmo_product_admin: use reverse_admin_url()

    As a side-effect, the urls are now corrected.

    Note that we delay the import of ProductVariation until list_variations() is called, as it is not known if the user has enabled the configurable product module.

    Fixes #1137.

    Reported-by: cra1g


  5. Tay Ray Chuan

    Merge in fix for admin urls

    References #1137.

    • commit 'c01d8c7': satchmo_product_admin: use reverse_admin_url() satchmo_utils.urlhelper: add reverse_admin_url() satchmo_utils.urlhelper: strip trailing whitespace satchmo_product_admin: don't wrap in () satchmo_product_admin: directly import reverse()


  6. Log in to comment