Re: menu highlight issue in django
Hi,
Since i am using session in my application i planed to check with the use of session.See my edit method for editing the report.
The idea is i need to create another session for edit method and if that created session is their,the menu should not highlighted,so if a user is going to open the existing report from Action needed page,always goes to edit_report method ,thus menu should not highlighted.I tried in this way please guide me to do and see my codes below.
def edit_report(request, report_id):
"""Edit report navigation from action needed screen
"""
user = request.user
if 'report_id' in request.session:
del request.session['report_id']
try:
member = Members.objects.get(member=user)
account_user = member.user
except:
account_user = user.id
request.session['report_id'] = report_id
request.session['account_user'] = account_user
return redirect('incident.views.new_report')
I added the two line " if not 'report_id' in request.session and not 'account_user' in request.session:
newreport_menu= False"
before return redirect ,but it is not working and i don't have idea how to do this but tried,kindly help me.
On Friday, July 5, 2013 7:55:34 PM UTC+5:30, roopas...@gmail.com wrote:
Hi,--
In my django application,I am creating new report using django session,and my application contain 3 tabs namely Reports,Search and New Report.Tab highlight says that the application is in which page.If user clicks New report,the New report tab will be highlighted.
User can view all the reports by clicking the report link from Report tab.
If the user clicks any one of the report namely "report id 5"in Report tab,that will open the report under New report Tab,so the New report menu gets highlighted.But i want it to not highlight because New report Tab is for creating only new report,while seeing the existing report i should not highlight the New report Tab.How to do it using django.
Now it is done in this way.
views.py
def method(request):
Some code
return render(request, sometemplate.html',
{'
'newreport_menu': True,
})
In menu tab,i validated like this
<li {% if newreport_menu %}class="current"{% endif %}><a href="{% url incident.views.new_report %}">New Report</a></li>
Now "New Report" menu is always gets highlighted for creating new report and if user click the existing report from Report Tab.But it should not highlight if the user clicks the existing report.
Need some tips how to do.
Thanks
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home