Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
KIF
AKPlanning
Commits
1bacaa70
Commit
1bacaa70
authored
2 years ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Improve room import for virtual rooms
parent
e38829cf
No related branches found
Branches containing commit
No related tags found
1 merge request
!140
Fix room adding form
Pipeline
#119473
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKModel/views.py
+16
-9
16 additions, 9 deletions
AKModel/views.py
with
16 additions
and
9 deletions
AKModel/views.py
+
16
−
9
View file @
1bacaa70
...
...
@@ -586,25 +586,32 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
def
form_valid
(
self
,
form
):
from
django.apps
import
apps
VIRTUAL_ROOMS_SUPPORT
=
False
if
apps
.
is_installed
(
"
AKOnline
"
):
VIRTUAL_ROOMS_SUPPORT
=
True
from
AKOnline.models
import
VirtualRoom
virtual_rooms_support
=
False
created_count
=
0
rooms_raw_dict
:
csv
.
DictReader
=
form
.
cleaned_data
[
"
rooms
"
]
if
apps
.
is_installed
(
"
AKOnline
"
)
and
"
url
"
in
rooms_raw_dict
.
fieldnames
:
virtual_rooms_support
=
True
from
AKOnline.models
import
VirtualRoom
for
raw_room
in
rooms_raw_dict
:
name
=
raw_room
[
"
name
"
]
location
=
raw_room
[
"
location
"
]
if
"
location
"
in
rooms_raw_dict
.
fieldnames
else
""
capacity
=
raw_room
[
"
capacity
"
]
if
"
capacity
"
in
rooms_raw_dict
.
fieldnames
else
-
1
url
=
raw_room
[
"
url
"
]
if
"
url
"
in
rooms_raw_dict
.
fieldnames
else
""
try
:
if
VIRTUAL_ROOMS_SUPPORT
and
url
!=
""
:
VirtualRoom
.
objects
.
create
(
name
=
name
,
location
=
location
,
capacity
=
capacity
,
url
=
url
,
event
=
self
.
event
)
if
virtual_rooms_support
and
raw_room
[
"
url
"
]
!=
""
:
VirtualRoom
.
objects
.
create
(
name
=
name
,
location
=
location
,
capacity
=
capacity
,
url
=
raw_room
[
"
url
"
],
event
=
self
.
event
)
else
:
Room
.
objects
.
create
(
name
=
name
,
location
=
location
,
capacity
=
capacity
,
event
=
self
.
event
)
Room
.
objects
.
create
(
name
=
name
,
location
=
location
,
capacity
=
capacity
,
event
=
self
.
event
)
created_count
+=
1
except
django
.
db
.
Error
as
e
:
messages
.
add_message
(
self
.
request
,
messages
.
WARNING
,
...
...
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