The answer is change for python2.7 & python3.6 . This pack is worked in python2.7 Could you try fond the pack worked in python3.6
> 在 2019年8月1日,下午4:07,胡超 <herohu...@gmail.com> 写道: > > When you install Django-common , exam the function ajax_required . Try to > fond error. > > Im sorry for my bad English. > >> 在 2019年8月1日,下午4:01,niranjan shukla <niranjanshukl...@gmail.com >> <mailto:niranjanshukl...@gmail.com>> 写道: >> >> views.py >> >> >> from django.http import JsonResponse >> from django.views.decorators.http import require_POST >> from common.decorators import ajax_required >> from .models import Contact >> >> @ajax_required >> @require_POST >> @login_required >> def user_follow(request): >> user_id = request.POST.get('id') >> action = request.POST.get('action') >> if user_id and action: >> try: >> user = User.objects.get(id=user_id) >> if action == 'follow': >> Contact.objects.get_or_create( >> user_from=request.user, >> user_to=user) >> else: >> Contact.objects.filter(user_from=request.user, >> user_to=user).delete() >> return JsonResponse({'status':'ok'}) >> except User.DoesNotExist: >> return JsonResponse({'status':'ko'}) >> return JsonResponse({'status':'ko'}) >> >> >> >> >> >> >> >> >> >> when I install the common then >> >> ERROR: >> >> File "C:\Users\user\Desktop\allauth1 - Copy\users\views.py", line 133, in >> <module> >> from common.decorators import ajax_required >> ModuleNotFoundError: No module named 'common.decorators' >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com >> <mailto:django-users+unsubscr...@googlegroups.com>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/74db8c7d-0a62-4736-8b0a-e2b355055007%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/74db8c7d-0a62-4736-8b0a-e2b355055007%40googlegroups.com?utm_medium=email&utm_source=footer>. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1414083F-4457-48F6-B694-5816DB6F8C5A%40gmail.com.