moodleNotifer
Functions
views.py File Reference

File documentation. More...

Go to the source code of this file.

Functions

def main.views.index (response)
 Create your views here. More...
 
def main.views.updater (response)
 
def main.views.home (response)
 This definition is used for Home page rendering.
 
def main.views.success (response)
 After Submission fo form, this page will be rendered.
 
def main.views.sms_reply (request)
 This definition is used to check if the user gets registered and sends the respective Response to the user. More...
 
def main.views.register (response)
 This definition will add entries into the Student Table in the Database.
 

Detailed Description

File documentation.

Definition in file views.py.

Function Documentation

◆ index()

def main.views.index (   response)

Create your views here.

the default path is loaded to index page which renders base.html page

Definition at line 31 of file views.py.

31 def index(response):
32  return render(response, "main/base.html",{})
33 

◆ sms_reply()

def main.views.sms_reply (   request)

This definition is used to check if the user gets registered and sends the respective Response to the user.

Respond to incoming calls with a simple text message.

Definition at line 57 of file views.py.

57 def sms_reply(request):
58  """Respond to incoming calls with a simple text message."""
59  # Fetch the message
60  if request.method == "POST":
61  # Create reply
62  message = request.POST['Body']
63  phone_no=request.POST['From']
64  print(phone_no)
65  if phone_no :
66  phone_no = phone_no[-10:]
67  if Student.objects.filter(phone_number = phone_no).exists():
68  reply=fetch_reply(message,phone_no)
69  resp = MessagingResponse()
70  resp.message(reply)
71 
72  return HttpResponse(resp)
73  else:
74  resp = MessagingResponse()
75  resp.message("You are not registered!!")
76  return HttpResponse(resp)
77  else:
78  resp = MessagingResponse()
79  resp.message("Phone Number Not found!!")
80  return HttpResponse(resp)
81