Skip to content
Snippets Groups Projects
Unverified Commit b4807235 authored by Andreas Hubel's avatar Andreas Hubel
Browse files

add redirects via external_id for event and speaker

parent 457d0dd4
Branches
Tags
No related merge requests found
......@@ -51,6 +51,8 @@ urlpatterns = [
path('board/<int:pk>/delete', views.BoardEntryDeleteView.as_view(), name='board_entry_delete'),
path('channels', views.ChannelEventsView.as_view(), name='channel_events'),
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_personal_calendar', views.ModifyPersonalCalendarView.as_view(), name='modify_personal_calendar'),
path('modify_theme', views.ModifyThemeView.as_view(), name='modify_theme'),
......
__all__ = (
'AssembliesEventsView',
'EventView',
'EventByExternalIdView',
'UpcomingView',
'ChannelEventsView',
'SosList',
......@@ -25,6 +26,7 @@ from core.models import (
RoomLink,
TagItem,
)
from core.models.schedules import ScheduleSourceMapping
from plainui.views.utils import ConferenceRequiredMixin, event_filter, organize_events_for_calendar, session_get_favorite_events, session_get_scheduled_events
......@@ -92,6 +94,15 @@ class EventView(ConferenceRequiredMixin, TemplateView):
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):
template_name = 'plainui/upcoming.html'
......
__all__ = (
'UserView',
'UserByUuidView',
'UserByExternalIdView',
)
from django.db.models import Q
......@@ -14,6 +15,7 @@ from core.models import (
UserBadge,
UserContact,
)
from core.models.schedules import ScheduleSourceMapping
from plainui.views.utils import (
ConferenceRequiredMixin,
......@@ -69,3 +71,9 @@ class UserByUuidView(ConferenceRequiredMixin, View):
def get(self, *args, uuid, **kwargs):
user = get_object_or_404(PlatformUser.objects.filter(uuid=uuid))
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}))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment