You probably have to import and use like this
https://docs.djangoproject.com/en/2.2/topics/http/shortcuts/#redirect
https://docs.djangoproject.com/en/2.2/topics/http/shortcuts/#redirect
from django.shortcuts import redirect def my_view(request): ... obj = MyModel.objects.get(...) return redirect(obj)
On Tue, May 28, 2019 at 1:49 AM Saeed Pooladzadeh <lingo1357@gmail.com> wrote:
--helloCan you please help me to understand the meaning of this error:
NameError at /emp
name 'redirect' is not defined
Request Method: POST Request URL: http://localhost:62597/emp Django Version: 2.2 Exception Type: NameError Exception Value: name 'redirect' is not defined
Exception Location: E:\Django_Try\bot4\bot3\saeed\views.py in emp, line 14 Python Executable: E:\Django_Try\bot4\bot3\env\Scripts\python.exe Python Version: 3.6.6 Python Path: ['E:\\Django_Try\\bot4\\bot3',
'',
'E:\\Django_Try\\bot4\\bot3',
'E:\\Django_Try\\bot4\\bot3\\env\\Scripts\\python36.zip',
'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\DLLs',
'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\lib',
'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64',
'E:\\Django_Try\\bot4\\bot3\\env',
'E:\\Django_Try\\bot4\\bot3\\env\\lib\\site-packages']Server time: Mon, 27 May 2019 23:01:46 +0000
Is it mean Django cant understand the meaning of redirect??But I have used redirect on my other project?
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/938de80b-874f-4339-a8ec-000bda037e74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANDnEWdFAZvfOZ8_ibAqDXNJVJOaVwUyzmBjBMpy5yuaO7N2ig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment