I have an existing Django application. I need to include a functionality in it which doesn't involve DB. I have written the operation to be performed in views.py
class VamComponent(View):
def getSectionADetails(self,request):
.......
return HttpResponse()
In urls.py I have included this line in urlpatterens:
url(r'^vamcomponent$', VamComponent.as_view())
I am able to access the details from this url http://localhost:8000/vamcomponent/ .
I need to have my endpoints with some value for section in the url like http://localhost:8000/vamcomponent/SectionA and http://localhost:8000/vamcomponent/SectionB.
In views.py if I modify the class to have 2 functions it,based on the value of section in the request it should call the respective method
class VamComponent(View):
def getSectionADetails(self,request):
.......
return HttpResponse()
def getSectionBDetails(self,request):
.......
return HttpResponse()
How to make this change in urls.py file so that getSectionADetails() is called when the request has SectionA in it else getSectionBDetails()?