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

add redirects via external_id for event and speaker

parent 3774b0a2
No related branches found
No related tags found
No related merge requests found
...@@ -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'),
......
__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'
......
__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}))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment