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
2af596ae
Commit
2af596ae
authored
1 year ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Allow creating default availabilities in batch room import
This implements
#175
parent
3c3b1070
No related branches found
No related tags found
1 merge request
!164
Allow creating default availabilities in batch room import
Pipeline
#163062
passed
1 year ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
AKModel/forms.py
+5
-0
5 additions, 0 deletions
AKModel/forms.py
AKModel/locale/de_DE/LC_MESSAGES/django.po
+15
-7
15 additions, 7 deletions
AKModel/locale/de_DE/LC_MESSAGES/django.po
AKModel/views/room.py
+6
-1
6 additions, 1 deletion
AKModel/views/room.py
with
26 additions
and
8 deletions
AKModel/forms.py
+
5
−
0
View file @
2af596ae
...
...
@@ -140,6 +140,11 @@ class RoomBatchCreationForm(AdminIntermediateForm):
widget
=
forms
.
Textarea
,
required
=
True
,
)
create_default_availabilities
=
forms
.
BooleanField
(
label
=
_
(
'
Default availabilities?
'
),
help_text
=
_
(
'
Create default availabilities for all rooms?
'
),
required
=
False
)
def
clean_rooms
(
self
):
rooms_raw_text
=
self
.
cleaned_data
[
"
rooms
"
]
...
...
This diff is collapsed.
Click to expand it.
AKModel/locale/de_DE/LC_MESSAGES/django.po
+
15
−
7
View file @
2af596ae
...
...
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-15 20:
03
+0200\n"
"POT-Creation-Date: 2023-05-15 20:
19
+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
@@ -240,7 +240,15 @@ msgstr ""
"Spalten sind \"location\", \"capacity\", und \"url\" for Online-/"
"HybridräumeTrennzeichen: Semikolon"
#: AKModel/forms.py:149
#: AKModel/forms.py:144
msgid "Default availabilities?"
msgstr "Standardverfügbarkeiten?"
#: AKModel/forms.py:145
msgid "Create default availabilities for all rooms?"
msgstr "Standardverfügbarkeiten für alle Räume anlegen?"
#: AKModel/forms.py:154
msgid "CSV must contain a name column"
msgstr "CSV muss eine name-Spalte enthalten"
...
...
@@ -1227,26 +1235,26 @@ msgid "Updated {u} slot(s). created {c} new slot(s) and deleted {d} slot(s)"
msgstr ""
"{u} Slot(s) aktualisiert, {c} Slot(s) hinzugefügt und {d} Slot(s) gelöscht"
#: AKModel/views/room.py:3
1
#: AKModel/views/room.py:3
2
#, python-format
msgid "Created Room '%(room)s'"
msgstr "Raum '%(room)s' angelegt"
#: AKModel/views/room.py:3
7
AKModel/views/status.py:64
#: AKModel/views/room.py:3
8
AKModel/views/status.py:64
msgid "Import Rooms from CSV"
msgstr "Räume aus CSV importieren"
#: AKModel/views/room.py:
68
#: AKModel/views/room.py:
73
#, python-brace-format
msgid "Could not import room {name}: {e}"
msgstr "Konnte Raum {name} nicht importieren: {e}"
#: AKModel/views/room.py:7
2
#: AKModel/views/room.py:7
7
#, python-brace-format
msgid "Imported {count} room(s)"
msgstr "{count} Raum/Räume importiert"
#: AKModel/views/room.py:7
4
#: AKModel/views/room.py:7
9
msgid "No rooms imported"
msgstr "Keine Räume importiert"
...
...
This diff is collapsed.
Click to expand it.
AKModel/views/room.py
+
6
−
1
View file @
2af596ae
...
...
@@ -8,6 +8,7 @@ from django.urls import reverse_lazy
from
django.utils.translation
import
gettext_lazy
as
_
from
django.views.generic
import
CreateView
from
AKModel.availability.models
import
Availability
from
AKModel.forms
import
RoomForm
,
RoomBatchCreationForm
from
AKModel.metaviews.admin
import
AdminViewMixin
,
EventSlugMixin
,
IntermediateAdminView
from
AKModel.models
import
Room
...
...
@@ -37,10 +38,11 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
title
=
_
(
"
Import Rooms from CSV
"
)
def
get_success_url
(
self
):
return
reverse_lazy
(
'
admin:event_status
'
,
kwargs
=
{
'
slug
'
:
self
.
event
.
slug
})
return
reverse_lazy
(
'
admin:event_status
'
,
kwargs
=
{
'
event_
slug
'
:
self
.
event
.
slug
})
def
form_valid
(
self
,
form
):
virtual_rooms_support
=
False
create_default_availabilities
=
form
.
cleaned_data
[
"
create_default_availabilities
"
]
created_count
=
0
rooms_raw_dict
:
csv
.
DictReader
=
form
.
cleaned_data
[
"
rooms
"
]
...
...
@@ -62,6 +64,9 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
if
virtual_rooms_support
and
raw_room
[
"
url
"
]
!=
""
:
VirtualRoom
.
objects
.
create
(
room
=
r
,
url
=
raw_room
[
"
url
"
])
if
create_default_availabilities
:
a
=
Availability
.
with_event_length
(
event
=
self
.
event
,
room
=
r
)
a
.
save
()
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