/ / dajaxice कार्यान्वयन न तो कोई त्रुटि दे रहा है और न ही काम कर रहा है - पायथन, django, formwizard, dajaxice

dajaxice कार्यान्वयन न तो कोई त्रुटि दे रहा है और न ही काम कर रहा है - पायथन, django, formwizard, dajaxice

मैं फॉर्मवार्ड में Dajaxice का उपयोग कर रहा हूं और एक बहुत ही उलझन में है, क्योंकि न तो यह कोई त्रुटि दिखाता है और न ही यह आउटपुट दिखाता है। मेरा कोड नीचे है:

ajax.py

from django.utils import simplejson
from dajaxice.decorators import dajaxice_register

@dajaxice_register
def sayhello(request):
return simplejson.dumps({"message":"Hello World"})

urls.py

from dajaxice.core import dajaxice_autodiscover, dajaxice_config
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
dajaxice_autodiscover()
urlpatterns = patterns("",
url(dajaxice_config.dajaxice_url, include("dajaxice.urls")),)

wizard1.html

{% block head %}
{% dajaxice_js_import %}
<title>My base template</title>

<script type="text/javascript">
function my_callback(data){alert(data.message);alert("Hello");}
</script>
{% endblock %}

{% block content %}
<input type="button" onclick="Dajaxice.trusform.dajaxice.core.sayhello(my_callback)" value="Get message from server!">
{% endblock %}

Django परियोजना

trustform
manage.py
trustform
ajax.py
forms.py
urls.py
settings.py
dajaxice
dajaxice.core.js
templates
wizard1.html

क्या आप पथ संरचना के बारे में विशेष रूप से सलाह दे सकते हैं, विशेष रूप से ऑनक्लिक विधियों में, क्योंकि मुझे संदेह है कि यह गलत पथों के कारण है लेकिन सुनिश्चित नहीं है।

उत्तर:

जवाब के लिए 0 № 1

बदलने की कोशिश करो

Dajaxice.trusform.dajaxice.core.sayhello

साथ में

Dajaxice.trustform.sayhello

के बाद से sayhello विधि आपके ऐप का हिस्सा है। साथ ही, आप "ट्रस्टफॉर्म" में "टी" गायब हो रहे हैं, इसलिए उसे भी जोड़ें।