Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
BeHub-web
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dominik Rosiek
BeHub-web
Commits
69acdf6b
Commit
69acdf6b
authored
Nov 21, 2015
by
Dominik Rosiek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.telemabk.pl:dominik/BeHub-web
parents
4770c2a6
3a8d0a64
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
57 additions
and
4 deletions
+57
-4
settings.py
BeHub/BeHub/settings.py
+14
-0
urls.py
BeHub/BeHub/urls.py
+9
-0
admin.py
BeHub/Hub/admin.py
+5
-0
models.py
BeHub/Hub/models.py
+0
-1
serializers.py
BeHub/Hub/serializers.py
+9
-3
views.py
BeHub/Hub/views.py
+18
-0
__init__.py
BeHub/__init__.py
+1
-0
__init__.py
__init__.py
+1
-0
No files found.
BeHub/BeHub/settings.py
View file @
69acdf6b
...
...
@@ -37,6 +37,7 @@ INSTALLED_APPS = (
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'rest_framework'
,
'rest_framework.authtoken'
,
'Hub'
,
)
...
...
@@ -50,6 +51,19 @@ MIDDLEWARE_CLASSES = (
'django.middleware.clickjacking.XFrameOptionsMiddleware'
,
)
REST_FRAMEWORK
=
{
'DEFAULT_PERMISSION_CLASSES'
:
(
'rest_framework.permissions.IsAuthenticated'
,),
'DEFAULT_FILTER_BACKENDS'
:
(
'rest_framework.filters.DjangoFilterBackend'
,),
'DEFAULT_AUTHENTICATION_CLASSES'
:
(
'rest_framework.authentication.SessionAuthentication'
,
'rest_framework.authentication.TokenAuthentication'
,
),
'DEFAULT_PAGINATION_CLASS'
:
'rest_framework.pagination.LimitOffsetPagination'
,
'PAGE_SIZE'
:
10
}
ANONYMOUS_USER_ID
=
-
1
ROOT_URLCONF
=
'BeHub.urls'
WSGI_APPLICATION
=
'BeHub.wsgi.application'
...
...
BeHub/BeHub/urls.py
View file @
69acdf6b
from
django.conf.urls
import
patterns
,
include
,
url
from
django.contrib
import
admin
from
rest_framework
import
routers
from
Hub
import
views
as
hub_views
router
=
routers
.
DefaultRouter
()
router
.
register
(
r'beacons'
,
hub_views
.
BeaconViewSet
)
router
.
register
(
r'projects'
,
hub_views
.
ProjectViewSet
)
urlpatterns
=
patterns
(
''
,
# Examples:
# url(r'^$', 'BeHub.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url
(
r'^api/'
,
include
(
router
.
urls
)),
url
(
r'^admin/'
,
include
(
admin
.
site
.
urls
)),
)
BeHub/Hub/admin.py
View file @
69acdf6b
from
django.contrib
import
admin
# Register your models here.
from
Hub.models
import
Beacon
from
Hub.models
import
Project
admin
.
register
(
Beacon
)
admin
.
register
(
Project
)
\ No newline at end of file
BeHub/Hub/models.py
View file @
69acdf6b
...
...
@@ -2,7 +2,6 @@ from django.db import models
# Create your models here.
class
Project
(
models
.
Model
):
link_url
=
models
.
CharField
(
max_length
=
2000
)
description
=
models
.
CharField
(
max_length
=
300
,
null
=
True
)
...
...
BeHub/Hub/serializers.py
View file @
69acdf6b
from
rest_framework
import
serializers
from
models
import
Beacon
from
Hub.models
import
Beacon
,
Project
class
BeaconSerializer
(
serializers
.
HyperlinkedModelSerializer
):
class
Meta
:
model
=
Beacon
fields
=
(
'id'
,
'url'
,
'title'
,
'source_url'
,
'content'
,
'image'
,
'activities'
)
fields
=
(
'id'
,
'url'
,
'uuid'
,
'name'
,
'project'
,
'description'
,)
class
ProjectSerializer
(
serializers
.
HyperlinkedModelSerializer
):
class
Meta
:
model
=
Project
fields
=
(
'id'
,
'url'
,
'link_url'
,
'description'
)
BeHub/Hub/views.py
View file @
69acdf6b
from
django.shortcuts
import
render
# Create your views here.
from
rest_framework
import
viewsets
from
Hub.models
import
Beacon
,
Project
from
Hub.serializers
import
BeaconSerializer
,
ProjectSerializer
class
BeaconViewSet
(
viewsets
.
ModelViewSet
):
"""
API for places
"""
queryset
=
Beacon
.
objects
.
all
()
serializer_class
=
BeaconSerializer
class
ProjectViewSet
(
viewsets
.
ModelViewSet
):
"""
API for places
"""
queryset
=
Project
.
objects
.
all
()
serializer_class
=
ProjectSerializer
\ No newline at end of file
BeHub/__init__.py
0 → 100644
View file @
69acdf6b
__author__
=
'Rafal'
__init__.py
0 → 100644
View file @
69acdf6b
__author__
=
'Rafal'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment