Commit 2e7a4ab7 authored by Rafal's avatar Rafal

add login

parent be4bcf2a
...@@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/1.7/ref/settings/ ...@@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
import os import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) BASE_DIR = os.path.dirname(os.path.dirname(__file__))
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
...@@ -97,3 +99,5 @@ USE_TZ = True ...@@ -97,3 +99,5 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.7/howto/static-files/ # https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
MEDIA_URL = '/media/'
\ No newline at end of file
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from django.contrib import admin from django.contrib import admin
from rest_framework import routers from rest_framework import routers
from django.conf.urls.static import static
from BeHub import settings
from Hub import views as hub_views from Hub import views as hub_views
from Hub.views import login_page
router = routers.DefaultRouter() router = routers.DefaultRouter()
router.register(r'beacons', hub_views.BeaconViewSet) router.register(r'beacons', hub_views.BeaconViewSet)
...@@ -13,8 +16,11 @@ router.register(r'uuid', hub_views.UuidBeaconViewSet) ...@@ -13,8 +16,11 @@ router.register(r'uuid', hub_views.UuidBeaconViewSet)
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^login/$', login_page),
url(r'^api/', include(router.urls)), url(r'^api/', include(router.urls)),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^api/uuid/(?P<pk>[0-9]+)/$', hub_views.UuidBeaconViewSet.as_view()), url(r'^api/uuid/(?P<pk>[0-9]+)/$', hub_views.UuidBeaconViewSet.as_view()),
url(r'^api/uuid/(?P<pk>[0-9]+)/(?P<category_name>\w+)/$', hub_views.UuidBeaconViewSet.as_view()), url(r'^api/uuid/(?P<pk>[0-9]+)/(?P<category_name>\w+)/$', hub_views.UuidBeaconViewSet.as_view()),
)
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
This source diff could not be displayed because it is too large. You can view the blob instead.
.panel-heading {
padding: 5px 15px;
}
.panel-footer {
padding: 1px 15px;
color: #A0A0A0;
}
.profile-img {
width: 96px;
height: 96px;
margin: 0 auto 10px;
display: block;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
}
\ No newline at end of file
{% load staticfiles%}
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{% static 'css/dashboard.css' %}" />
<div class="container" style="margin-top:40px">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<div class="panel panel-default">
<div class="panel-heading">
<strong>Login</strong>
</div>
<div class="panel-body">
<form role="form" action="#" method="POST">
<fieldset>
<div class="row">
<div class="center-block">
<img class="profile-img"
src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120" alt="">
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-10 col-md-offset-1 ">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-user"></i>
</span>
<input class="form-control" placeholder="username" name="loginname" type="text" required="" autofocus>
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-lock"></i>
</span>
<input class="form-control" placeholder="password" name="password" type="password" value="" required="">
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-lg btn-primary btn-block" value="Entrar">
</div>
</div>
</div>
</fieldset>
</form>
</div>
<div class="panel-footer ">
Não é registrado? <a href="#" onClick=""> Clique aqui </a>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import render from django.shortcuts import render, render_to_response
# Create your views here. # Create your views here.
from rest_framework import viewsets from rest_framework import viewsets
...@@ -66,4 +66,8 @@ class CategoryViewSet(viewsets.ModelViewSet): ...@@ -66,4 +66,8 @@ class CategoryViewSet(viewsets.ModelViewSet):
API for places API for places
""" """
queryset = Category.objects.all() queryset = Category.objects.all()
serializer_class = CategorySerializer serializer_class = CategorySerializer
\ No newline at end of file
def login_page(self):
return render_to_response('page/login.html', {})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment