def post(self):
        html.header(self)
        self.response.out.write(
            '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
        )
        self.response.out.write(
            '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
        )
        self.response.out.write(
            '<form action = "/mailingList" method = "get"><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
        )
        self.response.out.write(
            '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
        )
        html.weekFilter(self)
        search_query = cgi.escape(self.request.get("search"))
        name_query = search_query.title()
        contacts = datamodel.Contact.all()
        contacts.filter("firstName = ", name_query)
        for contact in contacts:
            html.listing(self, contact)

        contacts = datamodel.Contact.all()
        contacts.filter("lastName = ", name_query)
        for contact in contacts:
            html.listing(self, contact)

        contacts = datamodel.Contact.all()
        contacts.filter("email = ", search_query)
        for contact in contacts:
            html.listing(self, contact)
        html.footer(self)
 def get(self):
     html.header(self)
     self.response.out.write(
         '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/mailingList" method = "get"><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
     )
     self.response.out.write(
         '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
     )
     html.weekFilter(self)
     contacts = datamodel.Contact.all().order("lastName")
     for contact in contacts:
         html.listing(self, contact)
     html.footer(self)
 def get(self):
     html.header(self)
     wid = int(float(string.lstrip(self.request.path, "week/")))
     week = datamodel.Week.get_by_id(wid)
     self.response.out.write(
         '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/mailingList" method = "get"><input type="hidden" name="week" value="'
         + str(wid)
         + '"></input><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
     )
     self.response.out.write(
         '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
     )
     html.weekFilter(self)
     contacts = datamodel.Contact.all()
     contacts.filter("weeks = ", week.key())
     for contact in contacts:
         html.listing(self, contact)
     html.footer(self)