2009-06-02 12 views
6

मैं Django के साथ आने वाले पासवर्ड रीसेट सेटअप का उपयोग करने का प्रयास कर रहा हूं, लेकिन दस्तावेज़ इसके लिए बहुत अच्छा नहीं है। मैं Django 1.0 उपयोग कर रहा हूँ और मैं इस त्रुटि प्राप्त हो रही: मेरे urlconf मेंडिफ़ॉल्ट पासवर्ड रीसेट का उपयोग कर Django 1.0,

Caught an exception while rendering: Reverse for 'mysite.django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments ... 

मैं कुछ इस तरह है:

#django.contrib.auth.views 
urlpatterns = patterns('django.contrib.auth.views',  
    (r'^password_reset/$', 'password_reset', {'template_name': 'accounts/registration/password_reset_form.html', 'email_template_name':'accounts/registration/password_reset_email.html', 'post_reset_redirect':'accounts/login/'}), 
    (r'^password_reset/done/$', 'password_reset_done', {'template_name': 'accounts/registration/password_reset_done.html'}), 
    (r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'password_reset_confirm', {'template_name': 'accounts/registration/password_reset_confirm.html', 'post_reset_redirect':'accounts/login/', 'post_reset_redirect':'accounts/reset/done/'}), 
    (r'^reset/done/$', 'password_reset_complete', {'template_name': 'accounts/registration/password_reset_complete.html'}), 
) 

समस्या इस फ़ाइल में हो रहा है:

password_reset_email.html 

लाइन पर 7

{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %} 

मुझे क्या हो रहा है के नुकसान में है, इसलिए किसी भी मदद की सराहना की जाएगी।

धन्यवाद

उत्तर

2

बस समाधान मैं के साथ आया था पोस्ट करने के लिए करना चाहता था। समस्या इस पंक्ति में था:

{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %} 

मैं वास्तव में एक 100% क्यों या तो नहीं कर रहा हूँ, तो मैं बस मुश्किल इस तरह यूआरएल कोडित:

http://mysite.com/accounts/reset/{{uid}}-{{token}}/ 
0

यह एक समस्या मैं अपने आप को नहीं 10 मिनट पहले पता लगा है। समाधान post_change_redirect मान को आपके द्वारा password_reset दृश्य में गुजरने वाले तर्कों के शब्दकोश में जोड़ना है।

तो यह क्या अब मेरा की तरह लग रही है:

(r'^/password/$', password_change, {'template_name': 'testing/password.html', 'post_change_redirect': '/account/'}) 

मुझे आशा है कि आप के लिए यह करता है! मैं मानता हूं कि इस विशेष सुविधा के लिए दस्तावेज कुछ हद तक कम है, लेकिन इसने मेरे प्रोजेक्ट के लिए एक ही समस्या हल की है।

संपादित करें: मुझे वास्तव में स्क्रॉल करना चाहिए था - आपने पहले से ही इसमें शामिल किया है। इसके लिए माफ़ी, लेकिन मुझे उम्मीद है कि आप इसे हल करें :)

3

संपादित करें: मैंने आपका उदाहरण उपयोग किया, और कीवर्ड पैरामीटर का उपयोग न करने के लिए बदलना पड़ा।

{% url django.contrib.auth.views.password_reset_confirm uid, token %} 

नामित पैरामीटर काम करते हैं, जब तक कि दोनों यूआईडी और टोकन परिभाषित किए जाते हैं। या तो परिभाषित नहीं कर रहे हैं या खाली मैं एक ही त्रुटि तुम क्या मिलता है:

{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %} 
+0

क्या आप इसे थोड़ा और समझा सकते हैं। "Urls.py में password_reset_confirm के लिए एक पंक्ति जोड़ने का प्रयास करें" का क्या मतलब है।मेरे उपरोक्त उदाहरण में तीसरा यूआरएल password_reset_confirm के लिए है। मुझे इसे अपने urls.py फ़ाइल में और कैसे जोड़ना चाहिए? धन्यवाद – Joe

+0

मेरी गलती को अनदेखा करने में, मैंने संपादित किया कि ऊपर मेरे लिए क्या काम किया। – dar

2

मैं अधिक के लिए इस के साथ संघर्ष किया गया है एक घंटे इस पृष्ठ पर सब कुछ और इंटरनेट पर हर दूसरे पेज की कोशिश कर रहा है। अंत में मेरे मामले में समस्या को हल करने मैं अपने password_reset_email.html टेम्पलेट के ऊपर से

{% load url from future %} 

को नष्ट करने के लिए किया था।

यूआरएल स्क्रिप्ट में "uidb36 = uid" भी ध्यान दें। यहां मेरा पूरा पासवर्ड_reset_email.html टेम्पलेट है, मुझे आशा है कि यह किसी को कुछ समय बचाएगा:

{% autoescape off %} 
    You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}. 


Please go to the following page and choose a new password: 
{% block reset_link %} 
{{ protocol }}://{{ domain }}{% url django.contrib.auth.views.password_reset_confirm uidb36=uid token=token %} 
{% endblock %} 

Your username, in case you've forgotten:" %} {{ user.username }} 

Thanks for using our site! 

The {{ site_name }} team 

{% endautoescape %} 
संबंधित मुद्दे