Advertisement
Guest User

Untitled

a guest
Feb 13th, 2013
1,325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. LOGIN_REDIRECT_URL = 'http://127.0.0.1:8000/home/'
  2.  
  3. urlpatterns = patterns('',
  4. url(r'^accounts/', include('dashboard.registration.backends.simple.urls')),
  5. url(r'^home/$', direct_to_template,{ 'template': 'index.html' }, 'index'),
  6. url(r'^home/', include(dashboard.home.urls)),
  7. url(r'^admin/', include(admin.site.urls)),
  8. )
  9.  
  10. urlpatterns = patterns('dashboard.home.views',
  11. url(r'^$',index,name='index'),
  12. )
  13.  
  14. def index(request):
  15. print 'index request'
  16. project_list = Project.objects.all().order_by('project_name')
  17. return render_to_response('index.html',{'project_list': project_list})
  18.  
  19. <body>
  20. {% if user.is_authenticated %}
  21. <p>Welcome, {{ user.username }}. Thanks for logging in.</p>
  22.  
  23. <h3>Home</h3>
  24. <ul>
  25. <li><a href="Add_Project/">Add a Project</a></li>
  26.  
  27. </ul>
  28.  
  29. <h3>Project list</h3>
  30. {% if project_list %}
  31. <ul>
  32. {% for project in project_list %}
  33. <li> <a href={{project.project_name}}>{{ project.project_name }}</a></li>
  34. {% endfor %}
  35. </ul>
  36. {% else %}
  37. <p>There are no Projects</p>
  38. {% endif %}
  39.  
  40. {% else %}
  41. <p>Welcome, new user. Please log in.</p>
  42. {% endif %}
  43. </body>
  44.  
  45. LOGIN_REDIRECT_URL = 'http://127.0.0.1:8000/home/'
  46.  
  47. url(r'^home/$', direct_to_template,{ 'template': 'index.html' }, 'index'),
  48. url(r'^home/', include(dashboard.home.urls)),
  49.  
  50. from django.shortcuts import render
  51.  
  52. def index(request):
  53. project_list = Project.objects.all().order_by('project_name')
  54. return render(request,'index.html',{'project_list': project_list})
  55.  
  56. <body>
  57. {% if user.is_authenticated %}
  58. <p>Welcome, {{ user.username }}. Thanks for logging in.</p>
  59. {% else %}
  60. <p>Welcome, new user. Please log in.</p>
  61. {% endif %}
  62.  
  63. <h3>Home</h3>
  64. <ul>
  65. <li><a href="Add_Project/">Add a Project</a></li>
  66.  
  67. </ul>
  68.  
  69. <h3>Project list</h3>
  70. {% if project_list %}
  71. <ul>
  72. {% for project in project_list %}
  73. <li> <a href={{project.project_name}}>{{ project.project_name }}</a></li>
  74. {% endfor %}
  75. </ul>
  76. {% else %}
  77. <p>There are no Projects</p>
  78. {% endif %}
  79.  
  80. </body>
  81.  
  82. from django.shortcuts import render
  83. from django.contrib.auth.decorators import login_required
  84.  
  85. @login_required
  86. def index(request):
  87. project_list = Project.objects.all().order_by('project_name')
  88. return render(request,'index.html',{'project_list': project_list})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement