I'm getting this error:

IndentationError at /polls/addchoice/
unindent does not match any outer indentation level (views.py, line
125)Request Method: POST
Request URL: http://127.0.0.1:8000/polls/addchoice/
Django Version: 1.2.4
Exception Type: IndentationError
Exception Value: unindent does not match any outer indentation level
(views.py, line 125)
Exception Location: C:\Python27\lib\site-packages\django\utils
\importlib.py in import_module, line 35
Python Executable: C:\Python27\python.exe
Python Version: 2.7.1
Python Path: ['C:\\Users\\hversemann\\djangoprojects\\mysite', 'C:\
\Python\\Lib', 'C:\\Python\\Lib\\site-packages', 'C:\\Users\\hversemann
\\Desktop\\PythonSourceFiles', 'C:\\Users\\hversemann\\djangoprojects\
\mysite', 'C:\\WINDOWS\\system32\\python27.zip', 'C:\\Python27\\DLLs',
'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\
\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']
Server time: Mon, 10 Jan 2011 15:46:45 -0600

and here's the code its referring to(3rd line below - def
countpolls(): ):

def addchoice(request):
    message = ""
    def countpolls():
        pollcount = Poll.objects.all().count()
        if pollcount > 0 :
            message = "Number of polls passed to form was " +
str(pollcount)
        else:
            message = "No polls passed in to form."

    countpolls()
    dctnry = {}

    if request.method == "POST":
            form = AddChoiceform(request.POST)
            if form.is_valid():
                pollid = form.cleaned_data['pollquestions']
                slctdchoice = form.cleaned_data['newchoice']
                if isinstance(pollid, int):
                        newchoice = Choice(poll=pollid, choice=slctdchoice, 
votes=0)
                        newchoice.save()
                        confirmmessage = "Choice: " + slctdchoice + " : has 
been save
for poll: " + str(pollid) + "."
                        dctnry = { 'form': form, 'infomessage': message,
'confirmmessage': confirmmessage }

        else:
            form = AddChoiceForm()
            dctnry = { 'form': form, 'infomessage': message }

    return render_to_response('polls/addchoice.html',
                              dctnry,
 
context_instance=RequestContext(request))


I've made some changes to this view so there maybe some problems with
the code as a whole but I'm not sure what it doesn't like about my
indentations. Thanks for the help.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to