I am trying to Redirect to the post’s page soon as it’s saved , well it’s saved but the redirection won’t work , it’s working very fine on the development server .. not in the production one .
I tried :
return HttpResponseRedirect(reverse('emr.main.views.viewprofile', args=(profile.id,)))
Well it’s working fine but, in production host i have to change emr.main.view.viewprofile to myproject.main.views.viewprofile ! because viewprofile itself it’s not working
then i got template syntax error :
TemplateSyntaxError Exception Value: Caught NoReverseMatch while
rendering: Reverse for ‘main.views.add_record’ with arguments
‘(47L,)’ and keyword arguments ‘{}’ not found.
main.view.add_comment which is a url tag
Add record
how to solve this issue ?
url.py
(r'^add/record/(?P<patient_id>\d+)/?$', add_record),
(r'^add/current/(?P<patient_id>\d+)/?$', add_current),
Edit :
The main issues are :
- Naming the APP/views needs to rename all the files to fix this for development instead of emr.main.views.add_records to myproject.main.views.. since function itself is not working
- URL tags such as {% url main.views.add_record profile.id %} still returning errors ..
You are passing a tuple to
reverse()whereas the function expects a list.Try
args=[profile.id]instead.However, it’s difficult to answer this properly without seeing the function definition (or at least signature) for the
viewprofile()function.