ビューに関数があることがわかるように、次のコードがありますが、C_account()
まだ取得しています
**Exception Type: ViewDoesNotExist at /create_account/
Exception Value: Could not import EPM.views.C_account. View does not exist in module EPM.views.**
問題が何であるかについて何か考えはありますか?
関数定義EPM/views.py
を含むビュー( ):C_account
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from EPM.forms import *
from EPM.models import *
from datetime import date
from django.contrib.sessions.models import Session
from django.conf.urls.defaults import *
from django.forms.formsets import formset_factory
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'deducive.settings'
from django.core.management import setup_environ
from deducive import settings
import csv
def C_account(request):
if request.method == 'POST':
form = CreateAccountForm(request.POST)
if form.is_valid():
acc_act_date = form.cleaned_data['Account_Activation_Date']
present_date = date.today()
if acc_act_date <= present_date:
stat = 'active'
else:
stat = 'inactive'
acc_cat_id = Account_Categories_T.objects.get(cat_name = stat, category = 'status')
sto = GL_Account_T(account_number=form.cleaned_data['Account_Number'],
account_name=form.cleaned_data['Account_Name'],
account_description=form.cleaned_data['Account_Description'],
parent_account_number=form.cleaned_data['Parent_Account_Number'],
account_manager=form.cleaned_data['Account_Manager'],
account_category_id = acc_cat_id,
account_activation_date=form.cleaned_data['Account_Activation_Date'],
)
sto.save()
return HttpResponseRedirect('/create_account/thanks/')
else:
form = CreateAccountForm()
return render_to_response('CreateAccountForm.html', {'form': form}, context_instance=RequestContext(request))
def thanks(request):
return render_to_response('Thanks.html')
そして、URLConf(EPM/urls.py
)は、ビューがURLC_account
に正しく接続されています。create_account/
from django.conf.urls import patterns, include, url
urlpatterns = patterns('EPM.views',
(r'^create_account/$', 'C_account'),
(r'^create_account/thanks/$', 'thanks'),)