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
Dominik Weitz
AKPlanning
Commits
ca468556
Commit
ca468556
authored
2 years ago
by
Nadja Geisler
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature-auto-availabilites' into 'main'
Allow creating default availabilities in batch room import Closes
#175
See merge request
!164
parents
3c3b1070
2af596ae
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
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 @
ca468556
...
@@ -140,6 +140,11 @@ class RoomBatchCreationForm(AdminIntermediateForm):
...
@@ -140,6 +140,11 @@ class RoomBatchCreationForm(AdminIntermediateForm):
widget
=
forms
.
Textarea
,
widget
=
forms
.
Textarea
,
required
=
True
,
required
=
True
,
)
)
create_default_availabilities
=
forms
.
BooleanField
(
label
=
_
(
'
Default availabilities?
'
),
help_text
=
_
(
'
Create default availabilities for all rooms?
'
),
required
=
False
)
def
clean_rooms
(
self
):
def
clean_rooms
(
self
):
rooms_raw_text
=
self
.
cleaned_data
[
"
rooms
"
]
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 @
ca468556
...
@@ -2,7 +2,7 @@ msgid ""
...
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
@@ -240,7 +240,15 @@ msgstr ""
...
@@ -240,7 +240,15 @@ msgstr ""
"Spalten sind \"location\", \"capacity\", und \"url\" for Online-/"
"Spalten sind \"location\", \"capacity\", und \"url\" for Online-/"
"HybridräumeTrennzeichen: Semikolon"
"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"
msgid "CSV must contain a name column"
msgstr "CSV muss eine name-Spalte enthalten"
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)"
...
@@ -1227,26 +1235,26 @@ msgid "Updated {u} slot(s). created {c} new slot(s) and deleted {d} slot(s)"
msgstr ""
msgstr ""
"{u} Slot(s) aktualisiert, {c} Slot(s) hinzugefügt und {d} Slot(s) gelöscht"
"{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
#, python-format
msgid "Created Room '%(room)s'"
msgid "Created Room '%(room)s'"
msgstr "Raum '%(room)s' angelegt"
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"
msgid "Import Rooms from CSV"
msgstr "Räume aus CSV importieren"
msgstr "Räume aus CSV importieren"
#: AKModel/views/room.py:
68
#: AKModel/views/room.py:
73
#, python-brace-format
#, python-brace-format
msgid "Could not import room {name}: {e}"
msgid "Could not import room {name}: {e}"
msgstr "Konnte Raum {name} nicht importieren: {e}"
msgstr "Konnte Raum {name} nicht importieren: {e}"
#: AKModel/views/room.py:7
2
#: AKModel/views/room.py:7
7
#, python-brace-format
#, python-brace-format
msgid "Imported {count} room(s)"
msgid "Imported {count} room(s)"
msgstr "{count} Raum/Räume importiert"
msgstr "{count} Raum/Räume importiert"
#: AKModel/views/room.py:7
4
#: AKModel/views/room.py:7
9
msgid "No rooms imported"
msgid "No rooms imported"
msgstr "Keine Räume importiert"
msgstr "Keine Räume importiert"
...
...
This diff is collapsed.
Click to expand it.
AKModel/views/room.py
+
6
−
1
View file @
ca468556
...
@@ -8,6 +8,7 @@ from django.urls import reverse_lazy
...
@@ -8,6 +8,7 @@ from django.urls import reverse_lazy
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
as
_
from
django.views.generic
import
CreateView
from
django.views.generic
import
CreateView
from
AKModel.availability.models
import
Availability
from
AKModel.forms
import
RoomForm
,
RoomBatchCreationForm
from
AKModel.forms
import
RoomForm
,
RoomBatchCreationForm
from
AKModel.metaviews.admin
import
AdminViewMixin
,
EventSlugMixin
,
IntermediateAdminView
from
AKModel.metaviews.admin
import
AdminViewMixin
,
EventSlugMixin
,
IntermediateAdminView
from
AKModel.models
import
Room
from
AKModel.models
import
Room
...
@@ -37,10 +38,11 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
...
@@ -37,10 +38,11 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
title
=
_
(
"
Import Rooms from CSV
"
)
title
=
_
(
"
Import Rooms from CSV
"
)
def
get_success_url
(
self
):
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
):
def
form_valid
(
self
,
form
):
virtual_rooms_support
=
False
virtual_rooms_support
=
False
create_default_availabilities
=
form
.
cleaned_data
[
"
create_default_availabilities
"
]
created_count
=
0
created_count
=
0
rooms_raw_dict
:
csv
.
DictReader
=
form
.
cleaned_data
[
"
rooms
"
]
rooms_raw_dict
:
csv
.
DictReader
=
form
.
cleaned_data
[
"
rooms
"
]
...
@@ -62,6 +64,9 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
...
@@ -62,6 +64,9 @@ class RoomBatchCreationView(EventSlugMixin, IntermediateAdminView):
if
virtual_rooms_support
and
raw_room
[
"
url
"
]
!=
""
:
if
virtual_rooms_support
and
raw_room
[
"
url
"
]
!=
""
:
VirtualRoom
.
objects
.
create
(
room
=
r
,
VirtualRoom
.
objects
.
create
(
room
=
r
,
url
=
raw_room
[
"
url
"
])
url
=
raw_room
[
"
url
"
])
if
create_default_availabilities
:
a
=
Availability
.
with_event_length
(
event
=
self
.
event
,
room
=
r
)
a
.
save
()
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