def disease_model_index(request): if request.method == 'POST': # If the form has been submitted... form = DiseaseModelCreationForm(request.POST) # A form bound to the POST data if form.is_valid(): # All validation rules pass dm = DiseaseModel(**form.cleaned_data) return HttpResponseRedirect(dm.get_absolute_url()) # Redirect after POST else: form = DiseaseModelCreationForm() dms = DiseaseModel.objects.all().order_by('-id') paginated_models = view_utils.paginated_models(request, dms) return render_to_response('disease_model/index.html', {'form': form, 'paginated_models': paginated_models})
def age_specific_rate_function_index(request): if request.method == 'POST': # If the form has been submitted... form = ASRFCreationForm(request.POST) # A form bound to the POST data if form.is_valid(): # All validation rules pass asrfs = age_specific_rate_function.create_multiple(**form.cleaned_data) return HttpResponseRedirect('/age_specific_rate_function/%s' % view_utils.objects_to_id_str(asrfs)) # Redirect after POST else: form = ASRFCreationForm() asrfs = AgeSpecificRateFunction.objects.all().order_by('-id') paginated_models = view_utils.paginated_models(request, asrfs) return render_to_response('age_specific_rate_function/index.html', {'form': form, 'paginated_models': paginated_models})