راحترین روش برای اضافه کردن فیلد ReCaptcha
برای صفحه ورود ادمین
4 قدم ساده
- نصب کردن
django-captcha-admin
:
$> pip install django-captcha-admin
- اضافه کردن
captcha_admin
وcaptcha
به لیست برنامه های نصب شده در فایلsetting.py
:
INSTALLED_APPS = (
...
'captcha_admin',
'captcha',
)
- ثبت نام در
reCAPTCHA
برای دریافتKEY
و اضافه کردن بهsetting.py
:
#Setup recaptcha in setting.py
RECAPTCHA_PUBLIC_KEY = 'your-public-key'
RECAPTCHA_PRIVATE_KEY = 'your-private-key'
# If I'm not a Robot is required add:
NOCAPTCHA = True
- آخرین مرحله باید برای ایمپورت
admin
به جایdjango.contrib
ازcaptcha_admin
استفاده کنیم .
from captcha_admin import admin
# This should stay the same
admin.autodiscover()
urlpatterns = patterns(
...
url('admin/', include(admin.site.urls)), # and this...
...
)
امید وارم مفید باشه .