I have one function in view like
def calculate(request , b)
I want that this function should work even if b is not passes to it
You may also need to update your URL dispatch to handle the request with, or without, the optional parameter.
url(r'^calculate/?(?P<b>\d+)?/?$', 'calculate', name='calculate'),
url(r'^calculate/$', 'calculate', name='calculate'),
If you pass b via the URL it hits the first URL definition. If you do not include the optional parameter it hits the second definition but goes to the same view and uses the default value you provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With