Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LOGIN_REDIRECT_URL = 'http://127.0.0.1:8000/home/'
- urlpatterns = patterns('',
- url(r'^accounts/', include('dashboard.registration.backends.simple.urls')),
- url(r'^home/$', direct_to_template,{ 'template': 'index.html' }, 'index'),
- url(r'^home/', include(dashboard.home.urls)),
- url(r'^admin/', include(admin.site.urls)),
- )
- urlpatterns = patterns('dashboard.home.views',
- url(r'^$',index,name='index'),
- )
- def index(request):
- print 'index request'
- project_list = Project.objects.all().order_by('project_name')
- return render_to_response('index.html',{'project_list': project_list})
- <body>
- {% if user.is_authenticated %}
- <p>Welcome, {{ user.username }}. Thanks for logging in.</p>
- <h3>Home</h3>
- <ul>
- <li><a href="Add_Project/">Add a Project</a></li>
- </ul>
- <h3>Project list</h3>
- {% if project_list %}
- <ul>
- {% for project in project_list %}
- <li> <a href={{project.project_name}}>{{ project.project_name }}</a></li>
- {% endfor %}
- </ul>
- {% else %}
- <p>There are no Projects</p>
- {% endif %}
- {% else %}
- <p>Welcome, new user. Please log in.</p>
- {% endif %}
- </body>
- LOGIN_REDIRECT_URL = 'http://127.0.0.1:8000/home/'
- url(r'^home/$', direct_to_template,{ 'template': 'index.html' }, 'index'),
- url(r'^home/', include(dashboard.home.urls)),
- from django.shortcuts import render
- def index(request):
- project_list = Project.objects.all().order_by('project_name')
- return render(request,'index.html',{'project_list': project_list})
- <body>
- {% if user.is_authenticated %}
- <p>Welcome, {{ user.username }}. Thanks for logging in.</p>
- {% else %}
- <p>Welcome, new user. Please log in.</p>
- {% endif %}
- <h3>Home</h3>
- <ul>
- <li><a href="Add_Project/">Add a Project</a></li>
- </ul>
- <h3>Project list</h3>
- {% if project_list %}
- <ul>
- {% for project in project_list %}
- <li> <a href={{project.project_name}}>{{ project.project_name }}</a></li>
- {% endfor %}
- </ul>
- {% else %}
- <p>There are no Projects</p>
- {% endif %}
- </body>
- from django.shortcuts import render
- from django.contrib.auth.decorators import login_required
- @login_required
- def index(request):
- project_list = Project.objects.all().order_by('project_name')
- return render(request,'index.html',{'project_list': project_list})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement