Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
303c934a
authored
Feb 05, 2013
by
x
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc: add course import script
parent
cf17d813
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
miscellaneous/import.py
+18
-0
No files found.
miscellaneous/import.py
0 → 100644
View file @
303c934a
from
django.core.management
import
setup_environ
from
cloud
import
settings
from
school.models
import
Course
setup_environ
(
settings
)
with
open
(
'/home/django/targykodok.csv'
)
as
f
:
for
l
in
f
.
readlines
():
nep
,
name
=
l
.
split
(
"
\\
"
)
o
,
created
=
Course
.
objects
.
get_or_create
(
code
=
nep
)
try
:
o
.
name
=
name
o
.
save
()
except
:
o
.
name
=
"
%
s (
%
s)"
%
(
name
,
nep
.
replace
(
"BMEVIII"
,
""
))
o
.
save
()
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