context_processors.py 581 B

12345678910111213
  1. from blog import models
  2. from system import settings
  3. def global_content(request):
  4. context = {'is_login': request.session['is_login'] if request.session.has_key('is_login') else False,
  5. 'user': request.session['login_user'] if request.session.has_key('login_user') else None,
  6. 'msg': request.session['msg'] if request.session.has_key('msg') else '','domain':settings.DOMAIN,
  7. 'category': models.Category.objects.all().order_by('seq')}
  8. if context['is_login']:
  9. context['tags'] = models.Tags.objects.all()
  10. return context