2👍
If I understand it well, once you’ve done the copy you want the page to be redirected so no more copy will be made. Do like this then:
...
if copy:
the actual copy and then...
return HttpResponseRedirect(redirect_to='/the-path-without-copy-parameter/')
...
Then you can improve your code:
- add copy as an actual route parameter, def copy_group(request,
copy=None) - generate the path in redirect_to instead of hardcoding it
- Out of topic: add a functional test for it if there is none 🙂
BTW, I’m not sure why you use a Get parameter and not just a different URL for it??
- [Django]-Unknown command: 'collectstatic' Django 1.7
- [Django]-.js files not included in page when using Django Form Assets (Media class) with crispy forms
Source:stackexchange.com