コード例 #1
0
ファイル: views.py プロジェクト: AdeneganJosiah/Sendinel
def register(request, group_id):
    '''
    Register a patient to an information group, i.e.
    a new subscription of the infoservice is created.
    '''
    ajax_url= reverse('web_check_call_received')
    
    # ways_of_communication = get_ways_of_communication(immediate = True)
    ways_of_communication = WayOfCommunication.objects.filter(
                                                enabled = True,
                                                can_send_immediately = True)
    
    if request.method == "POST":
        set_session_variables_for_register(request)
        
        form = RegisterPatientForGroupValidationForm(request.POST)
        if form.is_valid():
            number = fill_authentication_session_variable(request) 
            auth_number = AUTH_NUMBER
            backurl = reverse('web_index')        

            return redirect_to_authentication_or(reverse \
                    ('groups_register_save', 
                     kwargs = {'group_id': group_id}))
        else:
            logger.info("register: Invalid form.")
       
    group = get_object_or_404(InfoService,pk = group_id)
    backurl = reverse("web_index")
    
    return render_to_response('groups/register.html', 
                              locals(),
                              context_instance = RequestContext(request))
コード例 #2
0
ファイル: views.py プロジェクト: AdeneganJosiah/Sendinel
def authenticate_phonenumber(request):
    nexturl = ''
    next = ''
    ajax_url= reverse('web_check_call_received')
    backurl = reverse('web_index')
    
   
    logger.info("Deleting timed out authentication calls.")
    delete_timed_out_authentication_calls()
    
    try:    
        number = fill_authentication_session_variable(request)
        logger.info("Starting authentication with %s" % AUTH_NUMBER)
        auth_number = AUTH_NUMBER
        next = request.GET.get('next', reverse('notifications_save'))
        return render_to_response('web/authenticate_phonenumber_call.html', 
                          locals(),
                          context_instance = RequestContext(request))
    except ValueError, e:
        error = e
コード例 #3
0
ファイル: views.py プロジェクト: AdeneganJosiah/Sendinel
def register(request):
    '''
    Register a patient to the waitinglist of a medicine, i.e.
    a new subscription of the infoservice is created.
    '''
    ajax_url= reverse('web_check_call_received')
    medicines = InfoService.objects.all().filter(type='medicine')
    
    ways_of_communication = get_ways_of_communication(immediate = True)
    
    if request.method == "POST":
        set_session_variables_for_register(request)
        
        infoservice = None
        form = None

        form = RegisterPatientForMedicineForm(request.POST)
        request.session['medicine'] = request.POST.get('medicine', '')
                
        if form.is_valid():
            number = fill_authentication_session_variable(request) 
            auth_number = AUTH_NUMBER
            backurl = reverse('web_index')

            return redirect_to_authentication_or(
                            reverse('medicines_register_save',
                                 kwargs = {'medicine_id': 
                                            request.session['medicine']}))
        else:
            logger.info("register patient for medicine: Invalid form.")
       
    backurl = reverse("web_index")
    
    return render_to_response('medicine/register.html', 
                              locals(),
                              context_instance = RequestContext(request))