Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
0bc2d48d
Commit
0bc2d48d
authored
4 years ago
by
Jiří Setnička
Browse files
Options
Downloads
Patches
Plain Diff
Opravy logování při vytváření/editaci a mazání míst
parent
5f58f6cd
No related branches found
No related tags found
1 merge request
!4
Dodělávky manipulace s places
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/org.py
+23
-9
23 additions, 9 deletions
mo/web/org.py
with
23 additions
and
9 deletions
mo/web/org.py
+
23
−
9
View file @
0bc2d48d
...
@@ -112,7 +112,7 @@ def org_place_edit(id: int):
...
@@ -112,7 +112,7 @@ def org_place_edit(id: int):
# School record removed
# School record removed
mo
.
util
.
log
(
mo
.
util
.
log
(
type
=
db
.
LogType
.
place
,
type
=
db
.
LogType
.
place
,
what
=
g
.
user
.
user
_id
,
what
=
school
.
place
_id
,
details
=
{
'
action
'
:
'
school-delete
'
,
'
school
'
:
db
.
row2dict
(
school
)},
details
=
{
'
action
'
:
'
school-delete
'
,
'
school
'
:
db
.
row2dict
(
school
)},
)
)
app
.
logger
.
info
(
f
"
Deleting school record for place
{
place
.
place_id
}
"
)
app
.
logger
.
info
(
f
"
Deleting school record for place
{
place
.
place_id
}
"
)
...
@@ -122,15 +122,15 @@ def org_place_edit(id: int):
...
@@ -122,15 +122,15 @@ def org_place_edit(id: int):
schoolChanges
=
db
.
get_object_changes
(
school
)
schoolChanges
=
db
.
get_object_changes
(
school
)
elif
request
.
form
.
get
(
'
type
'
)
==
'
school
'
:
elif
request
.
form
.
get
(
'
type
'
)
==
'
school
'
:
# School record created
# School record created
new
S
chool
=
db
.
School
()
new
_s
chool
=
db
.
School
()
new
S
chool
.
place_id
=
place
.
place_id
new
_s
chool
.
place_id
=
place
.
place_id
mo
.
util
.
log
(
mo
.
util
.
log
(
type
=
db
.
LogType
.
place
,
type
=
db
.
LogType
.
place
,
what
=
g
.
user
.
user
_id
,
what
=
new_school
.
place
_id
,
details
=
{
'
action
'
:
'
school-add
'
,
'
place_id
'
:
place
.
place_id
},
details
=
{
'
action
'
:
'
school-add
'
},
)
)
app
.
logger
.
info
(
f
"
Creating new school for place
{
place
.
place_id
}
"
)
app
.
logger
.
info
(
f
"
Creating new school for place
{
place
.
place_id
}
"
)
db
.
get_session
().
add
(
new
S
chool
)
db
.
get_session
().
add
(
new
_s
chool
)
# Take org directly to the school edit to fill the data
# Take org directly to the school edit to fill the data
msg
=
'
Záznam o škole vytvořen, vyplňte prosím všechna data
'
msg
=
'
Záznam o škole vytvořen, vyplňte prosím všechna data
'
redirectURL
=
url_for
(
'
org_place_edit
'
,
id
=
id
)
redirectURL
=
url_for
(
'
org_place_edit
'
,
id
=
id
)
...
@@ -139,7 +139,7 @@ def org_place_edit(id: int):
...
@@ -139,7 +139,7 @@ def org_place_edit(id: int):
app
.
logger
.
info
(
f
"
Place
{
id
}
modified, changes:
{
changes
}
"
)
app
.
logger
.
info
(
f
"
Place
{
id
}
modified, changes:
{
changes
}
"
)
mo
.
util
.
log
(
mo
.
util
.
log
(
type
=
db
.
LogType
.
place
,
type
=
db
.
LogType
.
place
,
what
=
g
.
user
.
user_
id
,
what
=
id
,
details
=
{
'
action
'
:
'
edit
'
,
'
changes
'
:
changes
},
details
=
{
'
action
'
:
'
edit
'
,
'
changes
'
:
changes
},
)
)
db
.
get_session
().
commit
()
db
.
get_session
().
commit
()
...
@@ -253,8 +253,21 @@ def org_place_delete(id: int):
...
@@ -253,8 +253,21 @@ def org_place_delete(id: int):
if
place
.
type
==
db
.
PlaceType
.
school
:
if
place
.
type
==
db
.
PlaceType
.
school
:
school
=
sess
.
query
(
db
.
School
).
get
(
place
.
place_id
)
school
=
sess
.
query
(
db
.
School
).
get
(
place
.
place_id
)
mo
.
util
.
log
(
type
=
db
.
LogType
.
place
,
what
=
school
.
place_id
,
details
=
{
'
action
'
:
'
school-delete
'
,
'
school
'
:
db
.
row2dict
(
school
)},
)
app
.
logger
.
info
(
f
"
Deleting school record for place
{
id
}
"
)
db
.
get_session
().
delete
(
school
)
db
.
get_session
().
delete
(
school
)
mo
.
util
.
log
(
type
=
db
.
LogType
.
place
,
what
=
id
,
details
=
{
'
action
'
:
'
delete
'
,
'
place
'
:
db
.
row2dict
(
place
)},
)
app
.
logger
.
info
(
f
"
Deleting place
{
id
}
"
)
parent
=
place
.
parent
parent
=
place
.
parent
db
.
get_session
().
delete
(
place
)
db
.
get_session
().
delete
(
place
)
db
.
get_session
().
commit
()
db
.
get_session
().
commit
()
...
@@ -286,12 +299,13 @@ def org_place_new_child(id: int):
...
@@ -286,12 +299,13 @@ def org_place_new_child(id: int):
form
.
populate_obj
(
new_place
)
form
.
populate_obj
(
new_place
)
new_place
.
parent
=
parent_place
.
place_id
new_place
.
parent
=
parent_place
.
place_id
new_place
.
level
=
parent_place
.
level
+
1
new_place
.
level
=
parent_place
.
level
+
1
db
.
get_session
().
add
(
new_place
)
sess
.
add
(
new_place
)
sess
.
flush
()
app
.
logger
.
info
(
f
"
New place created:
{
db
.
row2dict
(
new_place
)
}
"
)
app
.
logger
.
info
(
f
"
New place created:
{
db
.
row2dict
(
new_place
)
}
"
)
mo
.
util
.
log
(
mo
.
util
.
log
(
type
=
db
.
LogType
.
place
,
type
=
db
.
LogType
.
place
,
what
=
g
.
user
.
user
_id
,
what
=
new_place
.
place
_id
,
details
=
{
'
action
'
:
'
new
'
,
'
place
'
:
db
.
row2dict
(
new_place
)},
details
=
{
'
action
'
:
'
new
'
,
'
place
'
:
db
.
row2dict
(
new_place
)},
)
)
db
.
get_session
().
commit
()
db
.
get_session
().
commit
()
...
...
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