Skip to Content
Menu
This question has been flagged
2055 Views

Duplicate record is created in database on page reload (refresh) how to avoid it.
Please help me here.

--------------------here is my controller code-------------------------

class CallBackWindow(http.Controller):
   
    @http.route(['/callback'], auth='public',csrf=False, methods=['POST', 'GET'] ,type='http' ,website=True)
    def callback(self, **kwargs):
        print "here........................",kwargs
        print "dsff", http.request.env['callback.window']

        if kwargs:

            username = kwargs.get('username')
            number = kwargs.get('number')
            mail = kwargs.get('mail')
            location = kwargs.get('location')
            choice = kwargs.get('i_have')
            callback_window = request.registry['callback.window']
            user_data = {
                'name': username,
                'mobile_no': number,
                'email_id': mail,
                'location' : location,
                'requirement':choice,
              
                        }
            http.request.env['callback.window'].create( user_data)
        return http.request.render('call_back_window.call_back',{})

Avatar
Discard