Beispiel #1
0
    def post(self,trader_id):
        contact_json= simplejson.loads(self.request.body)
        trader_reference=Trader.get_by_id(int(trader_id))

        contact = Contact(trader=trader_reference,first_name=contact_json.first_name,last_name=contact_json.last_name)

        contact.role = contact_json.role
        contact.phone = contact_json.phone
        contact.email = contact_json.email
        self.save(contact)

        
Beispiel #2
0
    def post(self,trader_id):

        #load the trader reference to be set
        first_name = self.request.get('first_name')
        last_name = self.request.get('last_name')

        trader_reference=Trader.get_by_id(int(trader_id))

        contact = Contact(trader=trader_reference,first_name=first_name,last_name=last_name)

        contact.role = self.request.get('role')
        contact.phone = self.request.get('phone')
        contact.email = self.request.get('email')
    
        self.save(contact)
        
        self.redirect('/contact/%s/' % trader_id)