add login function
This commit is contained in:
		
							
								
								
									
										16
									
								
								billard/templates/registration/login.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								billard/templates/registration/login.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
{% extends 'billard/base.html' %}
 | 
			
		||||
{% load crispy_forms_tags %}
 | 
			
		||||
 | 
			
		||||
{% block title %}Login{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    <form action="{% url "login" %}" method="post" accept-charset="utf-8">
 | 
			
		||||
        {% csrf_token %}
 | 
			
		||||
        {{ form|crispy }}
 | 
			
		||||
        <input type="hidden" name="next" value="{{ next }}" />
 | 
			
		||||
        <input class="btn btn-default" type="submit" value="Login" />
 | 
			
		||||
 | 
			
		||||
    </form>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -9,7 +9,7 @@ router.register(r'tables', views.TableViewSet)
 | 
			
		||||
router.register(r'location_data', views.LocationDataViewSet)
 | 
			
		||||
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    url(r'^$', views.index, name='index'),
 | 
			
		||||
    url(r'^$', views.index, name='carom_index'),
 | 
			
		||||
    #url(r'^$', views.IndexView.as_view(), name='index'),
 | 
			
		||||
    url(r'^(?P<pk>[0-9]+)/$', views.LocationDataDetailView.as_view(), name='detail'),
 | 
			
		||||
    url(r'api/v1/', include(router.urls)),
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
 | 
			
		||||
    'django.contrib.staticfiles',
 | 
			
		||||
    'rest_framework',
 | 
			
		||||
    'rest_framework.authtoken',
 | 
			
		||||
    'crispy_forms',
 | 
			
		||||
    'billard',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@@ -131,6 +132,11 @@ REST_FRAMEWORK = {
 | 
			
		||||
    ),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CRISPY_TEMPLATE_PACK = 'bootstrap3'
 | 
			
		||||
LOGIN_URL = 'login'
 | 
			
		||||
LOGOUT_URL = 'logout'
 | 
			
		||||
LOGIN_REDIRECT_URL = 'carom_index'
 | 
			
		||||
 | 
			
		||||
STATIC_ROOT = "/srv/carom/carom-server/static/"
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
 
 | 
			
		||||
@@ -21,5 +21,6 @@ urlpatterns = [
 | 
			
		||||
    url(r'^admin/', admin.site.urls),
 | 
			
		||||
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
 | 
			
		||||
    url(r'^billard/', include('billard.urls')),
 | 
			
		||||
    url(r'^', include('django.contrib.auth.urls')),
 | 
			
		||||
    url(r'^.*$', RedirectView.as_view(url='billard/', permanent=False), name='index')
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user