Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
campaign
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
piphone
campaign
Commits
9d588ff6
Commit
9d588ff6
authored
Aug 06, 2016
by
okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix
#3
removed patterns()
parent
20592a0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
picampaign/contact/management/commands/import_meps_from_compotista.py
...ontact/management/commands/import_meps_from_compotista.py
+5
-5
picampaign/urls.py
picampaign/urls.py
+6
-5
No files found.
picampaign/contact/management/commands/import_meps_from_compotista.py
View file @
9d588ff6
...
@@ -19,14 +19,14 @@ class Command(BaseCommand):
...
@@ -19,14 +19,14 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
if
not
exists
(
JSON_DUMP_LOCALIZATION
):
if
not
exists
(
JSON_DUMP_LOCALIZATION
):
print
"download lastest data dump of meps from compotista"
print
(
"download lastest data dump of meps from compotista"
)
urllib
.
urlretrieve
(
'http://compotista.mm.staz.be/latest/'
,
JSON_DUMP_LOCALIZATION
)
urllib
.
urlretrieve
(
'http://compotista.mm.staz.be/latest/'
,
JSON_DUMP_LOCALIZATION
)
print
"load json"
print
(
"load json"
)
meps
=
json
.
load
(
open
(
JSON_DUMP_LOCALIZATION
,
"r"
))
meps
=
json
.
load
(
open
(
JSON_DUMP_LOCALIZATION
,
"r"
))
# This should not be used, since old contacts should stay in database
# This should not be used, since old contacts should stay in database
print
"cleaning Contacts"
print
(
"cleaning Contacts"
)
Contact
.
objects
.
all
().
delete
()
Contact
.
objects
.
all
().
delete
()
print
"adding Contacts"
print
(
"adding Contacts"
)
added
=
0
added
=
0
for
mep
in
meps
:
for
mep
in
meps
:
insert_mep
=
False
insert_mep
=
False
...
@@ -60,7 +60,7 @@ class Command(BaseCommand):
...
@@ -60,7 +60,7 @@ class Command(BaseCommand):
twitter
=
twitter
twitter
=
twitter
)
)
added
+=
1
added
+=
1
print
'%d - %s %s'
%
(
added
,
first_name
,
last_name
)
print
(
'%d - %s %s'
%
(
added
,
first_name
,
last_name
)
)
if
added
>=
50
:
if
added
>=
50
:
return
return
picampaign/urls.py
View file @
9d588ff6
from
django.conf.urls
import
patterns
,
include
,
url
from
django.conf.urls
import
include
,
url
from
django.contrib
import
admin
from
django.contrib
import
admin
from
rest_framework_nested
import
routers
from
rest_framework_nested
import
routers
...
@@ -18,7 +18,8 @@ campaign_router.register(r'categories', CategoryViewSet)
...
@@ -18,7 +18,8 @@ campaign_router.register(r'categories', CategoryViewSet)
campaign_router
.
register
(
r
'feedbacks'
,
FeedbackViewSet
)
campaign_router
.
register
(
r
'feedbacks'
,
FeedbackViewSet
)
urlpatterns
=
patterns
(
''
,
urlpatterns
=
[
url
(
r
'^admin/'
,
include
(
admin
.
site
.
urls
)),
url
(
r
'^admin/'
,
include
(
admin
.
site
.
urls
)),
url
(
r
'^'
,
include
(
router
.
urls
)),
url
(
r
'^'
,
include
(
router
.
urls
)),
url
(
r
'^'
,
include
(
campaign_router
.
urls
)))
url
(
r
'^'
,
include
(
campaign_router
.
urls
))
]
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