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
7f3dd59d
Commit
7f3dd59d
authored
Jan 10, 2016
by
Rafal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add init localization script
parent
b22d500b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
__init__.py
JoinTheCityREST/app/Localization/management/__init__.py
+1
-0
__init__.py
...CityREST/app/Localization/management/commands/__init__.py
+1
-0
init_localizations.py
...pp/Localization/management/commands/init_localizations.py
+23
-0
No files found.
JoinTheCityREST/app/Localization/management/__init__.py
0 → 100644
View file @
7f3dd59d
__author__
=
'Rafal'
JoinTheCityREST/app/Localization/management/commands/__init__.py
0 → 100644
View file @
7f3dd59d
__author__
=
'Rafal'
JoinTheCityREST/app/Localization/management/commands/init_localizations.py
0 → 100644
View file @
7f3dd59d
from
django.contrib.auth.models
import
User
from
app.Localization.models
import
Localization
__author__
=
'Rafal'
from
django.core.management.base
import
BaseCommand
,
CommandError
class
Command
(
BaseCommand
):
help
=
'Closes the specified poll for voting'
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
'poll_id'
,
nargs
=
'+'
,
type
=
int
)
def
handle
(
self
,
*
args
,
**
options
):
localizations
=
[
[
'Krakow'
,
'52.025459'
,
'19.204102'
,
'1000'
],
[
'Miasteczko AGH'
,
'50.0679444'
,
'19.9028223'
,
'40'
],
[
'Nowa Huta'
,
'50.0752396'
,
'20.0729312'
,
'200'
],
]
print
"Creating Localizations"
for
localization
in
localizations
:
print
"Create {0}"
.
format
(
localization
[
0
])
new_localization
=
Localization
.
objects
.
create
(
name
=
localization
[
0
],
longitude
=
localization
[
1
],
latitude
=
localization
[
2
],
range
=
localization
[
3
])
new_localization
.
save
()
\ No newline at end of file
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