Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
JoinTheCity
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
Rafal
JoinTheCity
Commits
73af1f0a
Commit
73af1f0a
authored
Jan 12, 2016
by
Rafal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add description, icon_www
parent
4c7196ee
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
init_apis.py
JoinTheCityREST/app/API/management/commands/init_apis.py
+9
-9
models.py
JoinTheCityREST/app/API/models.py
+2
-0
serializers.py
JoinTheCityREST/app/API/serializers.py
+1
-1
No files found.
JoinTheCityREST/app/API/management/commands/init_apis.py
View file @
73af1f0a
...
@@ -10,20 +10,20 @@ class Command(BaseCommand):
...
@@ -10,20 +10,20 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
apis
=
[
apis
=
[
[
'Apteki w Krakowie'
,
'Krakow'
,
'map'
,
'apteki'
],
[
'Apteki w Krakowie'
,
'Krakow'
,
'map'
,
'apteki'
,
''
,
'Opis API o aptekach w Krakowie'
],
[
'Baseny w Krakowie'
,
'Krakow'
,
'map'
,
'baseny'
],
[
'Baseny w Krakowie'
,
'Krakow'
,
'map'
,
'baseny'
,
''
,
'Opis API o aptekach w Krakowie'
],
[
'Hotele w Krakowie'
,
'Krakow'
,
'map'
,
' hotele'
],
[
'Hotele w Krakowie'
,
'Krakow'
,
'map'
,
' hotele'
,
''
,
'Opis API o aptekach w Krakowie'
],
[
'HotSpoty w Krakowie'
,
'Krakow'
,
'map'
,
' mapaHotSpotow'
],
[
'HotSpoty w Krakowie'
,
'Krakow'
,
'map'
,
' mapaHotSpotow'
,
''
,
'Opis API o aptekach w Krakowie'
],
[
'Utrudnienia w Krakowie'
,
'Krakow'
,
'map'
,
' mapaUtrudnien'
],
[
'Utrudnienia w Krakowie'
,
'Krakow'
,
'map'
,
' mapaUtrudnien'
,
''
,
'Opis API o aptekach w Krakowie'
],
[
'Restauracje w Krakowie'
,
'Krakow'
,
'map'
,
' restauracje'
],
[
'Restauracje w Krakowie'
,
'Krakow'
,
'map'
,
' restauracje'
,
''
,
'Opis API o aptekach w Krakowie'
],
[
'Szpitale w Krakowie'
,
'Krakow'
,
'map'
,
' szpitale'
],
[
'Szpitale w Krakowie'
,
'Krakow'
,
'map'
,
' szpitale'
,
''
,
'Opis API o aptekach w Krakowie'
],
[
'Zdarzenia drogowe w Krakowie'
,
'Krakow'
,
'map'
,
' zdarzeniaDrogowe'
],
[
'Zdarzenia drogowe w Krakowie'
,
'Krakow'
,
'map'
,
' zdarzeniaDrogowe'
,
''
,
'Opis API o aptekach w Krakowie'
],
]
]
print
"Creating APIs"
print
"Creating APIs"
for
api
in
apis
:
for
api
in
apis
:
print
"Create {0}"
.
format
(
api
[
0
])
print
"Create {0}"
.
format
(
api
[
0
])
tag
=
Tag
.
objects
.
filter
(
name
=
api
[
1
])[
0
]
tag
=
Tag
.
objects
.
filter
(
name
=
api
[
1
])[
0
]
api_type
=
APIType
.
objects
.
filter
(
name
=
api
[
2
])[
0
]
api_type
=
APIType
.
objects
.
filter
(
name
=
api
[
2
])[
0
]
new_api
=
API
.
objects
.
create
(
name
=
api
[
0
],
type
=
api_type
,
source
=
api
[
3
])
new_api
=
API
.
objects
.
create
(
name
=
api
[
0
],
type
=
api_type
,
source
=
api
[
3
]
,
icon_www
=
api
[
4
],
description
=
api
[
5
]
)
new_api
.
tag
=
[
tag
,
]
new_api
.
tag
=
[
tag
,
]
new_api
.
save
()
new_api
.
save
()
\ No newline at end of file
JoinTheCityREST/app/API/models.py
View file @
73af1f0a
...
@@ -18,6 +18,8 @@ class API(models.Model):
...
@@ -18,6 +18,8 @@ class API(models.Model):
type
=
models
.
ForeignKey
(
APIType
,
related_name
=
'API_type'
,
type
=
models
.
ForeignKey
(
APIType
,
related_name
=
'API_type'
,
blank
=
False
,
null
=
False
,
default
=
None
)
blank
=
False
,
null
=
False
,
default
=
None
)
source
=
models
.
CharField
(
max_length
=
100
)
source
=
models
.
CharField
(
max_length
=
100
)
icon_www
=
models
.
CharField
(
max_length
=
100
,
default
=
None
,
null
=
True
,
blank
=
True
)
description
=
models
.
CharField
(
max_length
=
300
,
default
=
None
,
null
=
True
,
blank
=
True
)
def
__str__
(
self
):
def
__str__
(
self
):
...
...
JoinTheCityREST/app/API/serializers.py
View file @
73af1f0a
...
@@ -6,7 +6,7 @@ class APISerializer(serializers.HyperlinkedModelSerializer):
...
@@ -6,7 +6,7 @@ class APISerializer(serializers.HyperlinkedModelSerializer):
class
Meta
:
class
Meta
:
model
=
API
model
=
API
fields
=
(
'url'
,
'name'
,
'tag'
,
'type'
,
'source'
)
fields
=
(
'url'
,
'name'
,
'tag'
,
'type'
,
'source'
,
'icon_www'
,
'description'
)
class
APITypeSerializer
(
serializers
.
HyperlinkedModelSerializer
):
class
APITypeSerializer
(
serializers
.
HyperlinkedModelSerializer
):
...
...
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