Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thomasDOTwtf
hub
Commits
e6a4e973
Commit
e6a4e973
authored
1 year ago
by
Andreas Hubel
Browse files
Options
Downloads
Patches
Plain Diff
add redirects via external_id for event and speaker
parent
3774b0a2
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plainui/urls.py
+2
-0
2 additions, 0 deletions
src/plainui/urls.py
src/plainui/views/events.py
+12
-0
12 additions, 0 deletions
src/plainui/views/events.py
src/plainui/views/users.py
+8
-0
8 additions, 0 deletions
src/plainui/views/users.py
with
22 additions
and
0 deletions
src/plainui/urls.py
+
2
−
0
View file @
e6a4e973
...
@@ -53,6 +53,8 @@ urlpatterns = [
...
@@ -53,6 +53,8 @@ urlpatterns = [
path
(
'
board/<int:pk>/delete
'
,
views
.
BoardEntryDeleteView
.
as_view
(),
name
=
'
board_entry_delete
'
),
path
(
'
board/<int:pk>/delete
'
,
views
.
BoardEntryDeleteView
.
as_view
(),
name
=
'
board_entry_delete
'
),
path
(
'
channels
'
,
views
.
ChannelEventsView
.
as_view
(),
name
=
'
channel_events
'
),
path
(
'
channels
'
,
views
.
ChannelEventsView
.
as_view
(),
name
=
'
channel_events
'
),
path
(
'
fahrplan
'
,
views
.
FahrplanView
.
as_view
(),
name
=
'
fahrplan
'
),
path
(
'
fahrplan
'
,
views
.
FahrplanView
.
as_view
(),
name
=
'
fahrplan
'
),
path
(
'
fahrplan/events/<external_id>.html
'
,
views
.
EventByExternalIdView
.
as_view
(),
name
=
'
event_by_external_id
'
),
path
(
'
fahrplan/speakers/<external_id>.html
'
,
views
.
UserByExternalIdView
.
as_view
(),
name
=
'
user_by_external_id
'
),
path
(
'
modify_favorites
'
,
views
.
ModifyFavoritesView
.
as_view
(),
name
=
'
modify_favorites
'
),
path
(
'
modify_favorites
'
,
views
.
ModifyFavoritesView
.
as_view
(),
name
=
'
modify_favorites
'
),
path
(
'
modify_theme
'
,
views
.
ModifyThemeView
.
as_view
(),
name
=
'
modify_theme
'
),
path
(
'
modify_theme
'
,
views
.
ModifyThemeView
.
as_view
(),
name
=
'
modify_theme
'
),
path
(
'
index
'
,
views
.
IndexView
.
as_view
(),
name
=
'
index
'
),
path
(
'
index
'
,
views
.
IndexView
.
as_view
(),
name
=
'
index
'
),
...
...
This diff is collapsed.
Click to expand it.
src/plainui/views/events.py
+
12
−
0
View file @
e6a4e973
__all__
=
(
__all__
=
(
'
AssembliesEventsView
'
,
'
AssembliesEventsView
'
,
'
EventByExternalIdView
'
,
'
UpcomingView
'
,
'
ChannelEventsView
'
,
'
ChannelEventsView
'
,
'
EventView
'
,
'
EventView
'
,
'
SosJoin
'
,
'
SosJoin
'
,
...
@@ -26,6 +28,7 @@ from core.models import (
...
@@ -26,6 +28,7 @@ from core.models import (
TagItem
,
TagItem
,
)
)
from
core.views.list_views
import
FilteredListView
from
core.views.list_views
import
FilteredListView
from
core.models.schedules
import
ScheduleSourceMapping
from
plainui.views.utils
import
ConferenceRequiredMixin
,
event_filter
,
organize_events_for_calendar
,
session_get_favorite_events
from
plainui.views.utils
import
ConferenceRequiredMixin
,
event_filter
,
organize_events_for_calendar
,
session_get_favorite_events
...
@@ -86,6 +89,15 @@ class EventView(ConferenceRequiredMixin, TemplateView):
...
@@ -86,6 +89,15 @@ class EventView(ConferenceRequiredMixin, TemplateView):
return
context
return
context
class
EventByExternalIdView
(
ConferenceRequiredMixin
,
View
):
def
get
(
self
,
*
args
,
external_id
,
**
kwargs
):
# TODO: What happens if there are multiple matching mappings?
# should we prefer import sources of official assemblies
# should we filter on the current conference?
m
=
get_object_or_404
(
ScheduleSourceMapping
.
objects
.
filter
(
mapping_type
=
'
event
'
,
source_id
=
external_id
))
return
redirect
(
reverse
(
'
plainui:event
'
,
kwargs
=
{
'
guid
'
:
m
.
local_id
}))
class
UpcomingView
(
ConferenceRequiredMixin
,
TemplateView
):
class
UpcomingView
(
ConferenceRequiredMixin
,
TemplateView
):
template_name
=
'
plainui/upcoming.html.j2
'
template_name
=
'
plainui/upcoming.html.j2
'
...
...
This diff is collapsed.
Click to expand it.
src/plainui/views/users.py
+
8
−
0
View file @
e6a4e973
__all__
=
(
__all__
=
(
'
UserByUuidView
'
,
'
UserByUuidView
'
,
'
UserView
'
,
'
UserView
'
,
'
UserByExternalIdView
'
,
)
)
from
django.db.models
import
Q
from
django.db.models
import
Q
...
@@ -16,6 +17,7 @@ from core.models import (
...
@@ -16,6 +17,7 @@ from core.models import (
UserBadge
,
UserBadge
,
UserContact
,
UserContact
,
)
)
from
core.models.schedules
import
ScheduleSourceMapping
from
plainui.views.utils
import
(
from
plainui.views.utils
import
(
ConferenceRequiredMixin
,
ConferenceRequiredMixin
,
...
@@ -86,3 +88,9 @@ class UserByUuidView(ConferenceRequiredMixin, View):
...
@@ -86,3 +88,9 @@ class UserByUuidView(ConferenceRequiredMixin, View):
def
get
(
self
,
*
args
,
uuid
,
**
kwargs
):
def
get
(
self
,
*
args
,
uuid
,
**
kwargs
):
user
=
get_object_or_404
(
PlatformUser
.
objects
.
filter
(
uuid
=
uuid
))
user
=
get_object_or_404
(
PlatformUser
.
objects
.
filter
(
uuid
=
uuid
))
return
redirect
(
reverse
(
'
plainui:user
'
,
kwargs
=
{
'
user_slug
'
:
user
.
slug
}))
return
redirect
(
reverse
(
'
plainui:user
'
,
kwargs
=
{
'
user_slug
'
:
user
.
slug
}))
class
UserByExternalIdView
(
ConferenceRequiredMixin
,
View
):
def
get
(
self
,
*
args
,
external_id
,
**
kwargs
):
m
=
get_object_or_404
(
ScheduleSourceMapping
.
objects
.
filter
(
mapping_type
=
'
speaker
'
,
source_id
=
external_id
))
return
redirect
(
reverse
(
'
plainui:user
'
,
kwargs
=
{
'
user_id
'
:
m
.
local_id
}))
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