Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nk20-scripts
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20-scripts
Commits
b9fdced3
Commit
b9fdced3
authored
5 years ago
by
Pierre-antoine Comby
Browse files
Options
Downloads
Plain Diff
Merge branch 'Update_Scripts' into 'master'
Update scripts See merge request
!1
parents
be8aa44e
146260b3
No related branches found
No related tags found
1 merge request
!1
Update scripts
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
management/commands/import_nk15.py
+6
-3
6 additions, 3 deletions
management/commands/import_nk15.py
with
6 additions
and
3 deletions
management/commands/import_nk15.py
+
6
−
3
View file @
b9fdced3
...
...
@@ -18,7 +18,7 @@ from django.contrib.auth.models import User
from
note.models
import
Note
,
NoteSpecial
,
NoteUser
,
NoteClub
from
note.models
import
Alias
from
note.models
import
Transaction
,
TransactionTemplate
,
\
TemplateCategory
,
Template
Transaction
,
MembershipTransaction
TemplateCategory
,
Recurrent
Transaction
,
MembershipTransaction
from
member.models
import
Profile
,
Club
,
Membership
"""
...
...
@@ -185,7 +185,7 @@ def import_transaction(cur, map_idbde):
if
created
:
cat
.
save
()
obj_dict
[
"
category
"
]
=
cat
transac
=
Template
Transaction
.
objects
.
create
(
**
obj_dict
)
transac
=
Recurrent
Transaction
.
objects
.
create
(
**
obj_dict
)
transac
.
save
()
elif
row
[
"
type
"
]
==
"
adhésion
"
:
print
(
"
adhesion not supported yet
"
)
...
...
@@ -231,13 +231,16 @@ class Command(BaseCommand):
parser
.
add_argument
(
'
-b
'
,
'
--boutons
'
,
action
=
'
store_true
'
,
help
=
"
import boutons
"
)
parser
.
add_argument
(
'
-t
'
,
'
--transactions
'
,
action
=
'
store_true
'
,
help
=
"
import transaction
"
)
parser
.
add_argument
(
'
-a
'
,
'
--aliases
'
,
action
=
'
store_true
'
,
help
=
"
import aliases
"
)
parser
.
add_argument
(
'
-d
'
,
'
--nk15db
'
,
action
=
'
store
'
,
default
=
'
nk15
'
,
help
=
'
NK15 database name
'
)
parser
.
add_argument
(
'
-u
'
,
'
--nk15user
'
,
action
=
'
store
'
,
default
=
'
nk15_user
'
,
help
=
'
NK15 database owner
'
)
def
handle
(
self
,
*
args
,
**
kwargs
):
nk15db
,
nk15user
=
kwargs
[
'
nk15db
'
],
kwargs
[
'
nk15user
'
]
#reset database.
call_command
(
"
flush
"
)
self
.
print_success
(
"
flush nk20 database
"
)
# connecting to nk15 database
conn
=
pg
.
connect
(
database
=
"
nk15
"
,
user
=
"
nk15
_
user
"
)
conn
=
pg
.
connect
(
database
=
nk15
db
,
user
=
nk15user
)
cur
=
conn
.
cursor
(
cursor_factory
=
pge
.
DictCursor
)
if
kwargs
[
"
special
"
]:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment