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
ab00259d
Commit
ab00259d
authored
Nov 22, 2015
by
Rafal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
blank
parent
c33bfdf2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
6 deletions
+27
-6
models.py
BeHub/Hub/models.py
+3
-2
beacon_detail.html
BeHub/Hub/templates/user_panel/content/beacon_detail.html
+5
-2
beacons.html
BeHub/Hub/templates/user_panel/content/beacons.html
+1
-1
dashboard.html
BeHub/Hub/templates/user_panel/content/dashboard.html
+13
-0
views.py
BeHub/Hub/views.py
+5
-1
No files found.
BeHub/Hub/models.py
View file @
ab00259d
...
...
@@ -7,7 +7,7 @@ from django.db import models
class
Site
(
models
.
Model
):
link_url
=
models
.
CharField
(
max_length
=
2000
)
description
=
models
.
CharField
(
max_length
=
300
,
null
=
True
)
category
=
models
.
ManyToManyField
(
'Category'
,
null
=
True
)
category
=
models
.
ManyToManyField
(
'Category'
,
blank
=
True
)
author
=
models
.
ForeignKey
(
User
)
def
__str__
(
self
):
...
...
@@ -27,6 +27,7 @@ class Beacon(models.Model):
description
=
models
.
CharField
(
max_length
=
300
,
null
=
True
)
longitude
=
models
.
DecimalField
(
max_digits
=
9
,
decimal_places
=
6
)
latitude
=
models
.
DecimalField
(
max_digits
=
9
,
decimal_places
=
6
)
beacon_manager
=
models
.
OneToOneField
(
'BeaconManager'
,
blank
=
True
)
def
__str__
(
self
):
return
"name: {name}, uuid:{uuid}"
.
format
(
name
=
self
.
name
,
uuid
=
self
.
uuid
)
...
...
@@ -41,7 +42,7 @@ class BeaconManager(models.Model):
class
UserProject
(
models
.
Model
):
author
=
models
.
ForeignKey
(
User
)
beacon_managers
=
models
.
ManyToManyField
(
'BeaconManager'
,
null
=
True
)
beacon_managers
=
models
.
ManyToManyField
(
'BeaconManager'
,
blank
=
True
)
name
=
models
.
CharField
(
max_length
=
300
)
description
=
models
.
CharField
(
max_length
=
300
,
null
=
True
)
...
...
BeHub/Hub/templates/user_panel/content/beacon_detail.html
View file @
ab00259d
...
...
@@ -6,10 +6,13 @@
<td
class=
"col-md-2"
>
{{ beacon_data.beacon.name }}
</td>
<td>
{% for site in beacon_data.sites %}
<p>
<a
href=
"site.link_url"
>
{{ site.link_url }}
</a></p>
{% for site in beacon_data.sites %}
<p>
<a
href=
"site.link_url"
>
{{ site.link_url }}
</a>
<button
class=
"btn btn-danger"
>
Usun
</button></p>
{% endfor %}
<p>
<button
class=
"btn btn-success"
>
Dodaj link
</button></p>
</td>
</tr>
</tbody>
</table>
...
...
BeHub/Hub/templates/user_panel/content/beacons.html
View file @
ab00259d
...
...
@@ -7,6 +7,6 @@
{% for beacon_data in beacon_display %}
{% include 'user_panel/content/beacon_detail.html' %}
{% endfor %}
{% include 'user_panel/content/beacon_detail.html' %}
</div>
\ No newline at end of file
BeHub/Hub/templates/user_panel/content/dashboard.html
View file @
ab00259d
...
...
@@ -7,6 +7,19 @@
<div
class=
"container"
>
<div
class=
"row"
>
<a
href=
"/project/{{ project.id }}"
>
<div
class=
"col-xs-12 col-sm-6 col-md-6 col-lg-6 col-lg-offset-3"
>
<div
class=
"box opacity"
>
<div
class=
"box-icon"
>
<span
class=
"fa fa-4x fa-html5"
></span>
</div>
<div
class=
"info"
>
<h4
class=
"text-center"
>
Nowy projekt
</h4>
</div>
</div>
</div>
</a>
{% for project in user_projects %}
<a
href=
"/project/{{ project.id }}"
>
<div
class=
"col-xs-12 col-sm-6 col-md-6 col-lg-6 col-lg-offset-3"
>
...
...
BeHub/Hub/views.py
View file @
ab00259d
...
...
@@ -53,7 +53,11 @@ class UserProjectViewSet(viewsets.ModelViewSet):
beacon_managers
=
user_project
.
beacon_managers
.
all
()
for
beacon_manager
in
beacon_managers
:
serializer_beacon
=
BeaconSerializer
(
beacon_manager
.
beacon
,
context
=
{
'request'
:
request
})
beacons
.
append
(
serializer_beacon
.
data
)
serializer_data
=
serializer_beacon
.
data
serializer_beacon_manager
=
BeaconManagerSerializer
(
beacon_manager
,
context
=
{
'request'
:
request
})
serializer_data
.
update
({
'beacon_manager'
:
serializer_beacon_manager
.
data
[
'url'
]})
beacons
.
append
(
serializer_data
)
return
Response
(
data
=
beacons
)
...
...
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