My url is like –
urlpatterns = patterns('network.network_api.views',
(r'^network/license/(?P<flag>\w{4,12})/?$', 'Check_License'),
)
here i want to allow only flag (ACTIVATE or DEACTIVATE), Kindly help me that what are the changes i should make in my url.
Even though it seems like a nice solution to have hard-coded flag within the url, I think its better to leave such a logic to the view, and if the flag in neither of the supported flags, raise an error. That in my opinion is more flexible in case you need to add flags in the future.
The following is if you still want a flag in the url. It makes sure the group which you use to add condition is not picked up by regex: