Procházet zdrojové kódy

Resolving #32: Making landing page default to starting server url

DrkSephy před 9 roky
rodič
revize
2b8a573792

+ 1 - 1
hackathon_starter/hackathon/templates/hackathon/base.html

@@ -24,7 +24,7 @@
             <span class="icon-bar"></span>
             <span class="icon-bar"></span>
           </button>
-          <a class="navbar-brand" href="/hackathon">Django Hackathon Starter</a>
+          <a class="navbar-brand" href="/">Django Hackathon Starter</a>
       </div>
 
       <!-- Collect the nav links, forms, and other content for toggling -->

+ 1 - 1
hackathon_starter/hackathon/templates/hackathon/register.html

@@ -5,7 +5,7 @@
     <body>
         {% if registered %}
           <strong>Thank you for registering!</strong>
-          <a href="/hackathon/">Return to the homepage.</a><br />
+          <a href="/hackathon/login/">Return to the homepage.</a><br />
         
         {% else %}
           <div class='container text-center'>

+ 0 - 1
hackathon_starter/hackathon/urls.py

@@ -7,7 +7,6 @@ router = DefaultRouter()
 router.register(r'snippets', views.SnippetView)
 
 urlpatterns = patterns('',
-    url(r'^$', views.index, name='index'),
     url(r'^', include(router.urls)),
     url(r'^register/$', views.register, name='register'),
     url(r'^login/$', views.user_login, name='login'),

+ 3 - 2
hackathon_starter/hackathon/views.py

@@ -739,6 +739,7 @@ def register(request):
             user.set_password(user.password)
             user.save()
             registered = True
+            return HttpResponseRedirect('/hackathon/login/')
         else:
             print user_form.errors
     else:
@@ -759,7 +760,7 @@ def user_login(request):
         if user:
             if user.is_active:
                 login(request, user)
-                return HttpResponseRedirect('/hackathon/')
+                return HttpResponseRedirect('/hackathon/api/')
             else:
                 return HttpResponse("Your Django Hackathon account is disabled.")
         else:
@@ -771,7 +772,7 @@ def user_login(request):
 
 def user_logout(request):
     logout(request)
-    return HttpResponseRedirect('/hackathon/')
+    return HttpResponseRedirect('/hackathon/login/')
 
 
 def instagram_login(request):

+ 2 - 0
hackathon_starter/hackathon_starter/urls.py

@@ -1,7 +1,9 @@
 from django.conf.urls import patterns, include, url
 from django.contrib import admin
+from hackathon import views
 
 urlpatterns = patterns('',
+    url(r'^$', views.index, name='index'),
     url(r'^hackathon/', include('hackathon.urls')),
     url(r'^admin/', include(admin.site.urls)),
     # url(r'^openid/(.*)', SessionConsumer()),