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
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
Felix Blanke
AKPlanning
Commits
65a6e993
Commit
65a6e993
authored
2 years ago
by
Nadja Geisler
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-room-add' into 'main'
Fix room adding form See merge request
!140
parents
15e6489c
1bacaa70
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AKModel/templates/admin/AKModel/room_change_form.html
+14
-12
14 additions, 12 deletions
AKModel/templates/admin/AKModel/room_change_form.html
AKModel/views.py
+16
-9
16 additions, 9 deletions
AKModel/views.py
with
30 additions
and
21 deletions
AKModel/templates/admin/AKModel/room_change_form.html
+
14
−
12
View file @
65a6e993
...
@@ -7,18 +7,20 @@
...
@@ -7,18 +7,20 @@
{% block extrahead %}
{% block extrahead %}
{{ block.super }}
{{ block.super }}
{% bootstrap_javascript jquery='slim' %}
{% bootstrap_javascript jquery='slim' %}
{% include "AKModel/load_fullcalendar_availabilities.html" %}
{% if original.event %}
{% include "AKModel/load_fullcalendar_availabilities.html" %}
<script>
<script>
{
%
get_current_language
as
LANGUAGE_CODE
%
}
{
%
get_current_language
as
LANGUAGE_CODE
%
}
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
createAvailabilityEditors
(
createAvailabilityEditors
(
'
{{ original.event.timezone }}
'
,
'
{{ original.event.timezone }}
'
,
'
{{ LANGUAGE_CODE }}
'
,
'
{{ LANGUAGE_CODE }}
'
,
'
{{ original.event.start | timezone:original.event.timezone | date:"Y-m-d H:i:s" }}
'
,
'
{{ original.event.start | timezone:original.event.timezone | date:"Y-m-d H:i:s" }}
'
,
'
{{ original.event.end | timezone:original.event.timezone | date:"Y-m-d H:i:s" }}
'
'
{{ original.event.end | timezone:original.event.timezone | date:"Y-m-d H:i:s" }}
'
);
);
});
});
</script>
</script>
{% endif %}
{% endblock %}
{% endblock %}
This diff is collapsed.
Click to expand it.
AKModel/views.py
+
16
−
9
View file @
65a6e993
...
@@ -586,25 +586,32 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
...
@@ -586,25 +586,32 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
def
form_valid
(
self
,
form
):
def
form_valid
(
self
,
form
):
from
django.apps
import
apps
from
django.apps
import
apps
VIRTUAL_ROOMS_SUPPORT
=
False
virtual_rooms_support
=
False
if
apps
.
is_installed
(
"
AKOnline
"
):
VIRTUAL_ROOMS_SUPPORT
=
True
from
AKOnline.models
import
VirtualRoom
created_count
=
0
created_count
=
0
rooms_raw_dict
:
csv
.
DictReader
=
form
.
cleaned_data
[
"
rooms
"
]
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
:
for
raw_room
in
rooms_raw_dict
:
name
=
raw_room
[
"
name
"
]
name
=
raw_room
[
"
name
"
]
location
=
raw_room
[
"
location
"
]
if
"
location
"
in
rooms_raw_dict
.
fieldnames
else
""
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
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
:
try
:
if
VIRTUAL_ROOMS_SUPPORT
and
url
!=
""
:
if
virtual_rooms_support
and
raw_room
[
"
url
"
]
!=
""
:
VirtualRoom
.
objects
.
create
(
name
=
name
,
location
=
location
,
capacity
=
capacity
,
url
=
url
,
event
=
self
.
event
)
VirtualRoom
.
objects
.
create
(
name
=
name
,
location
=
location
,
capacity
=
capacity
,
url
=
raw_room
[
"
url
"
],
event
=
self
.
event
)
else
:
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
created_count
+=
1
except
django
.
db
.
Error
as
e
:
except
django
.
db
.
Error
as
e
:
messages
.
add_message
(
self
.
request
,
messages
.
WARNING
,
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