Esempio n. 1
0
def manage_series(request, seriesid):
    series = get_authenticated_series(request, seriesid)

    return render(request, 'confreg/admin_dashboard_series.html', {
        'series': series,
        'breadcrumbs': (('/events/admin/', 'Series'),),
    })
Esempio n. 2
0
def edit_series_messaging(request, seriesid, rest):
    series = get_authenticated_series(request, seriesid)

    def _load_messaging_formclass(classname):
        return getattr(get_messaging_class(classname), 'provider_form_class',
                       BackendSeriesMessagingForm)

    formclass = BackendSeriesMessagingForm
    u = rest and rest.rstrip('/') or rest
    if u and u != '' and u.isdigit():
        # Editing an existing one, so pick the correct subclass!
        provider = get_object_or_404(MessagingProvider, pk=u, series=series)
        formclass = _load_messaging_formclass(provider.classname)
    elif u == 'new':
        if '_newformdata' in request.POST or 'classname' in request.POST:
            if '_newformdata' in request.POST:
                c = request.POST['_newformdata'].split(':')[0]
            else:
                c = request.POST['classname']

            if c not in messaging_implementations:
                raise PermissionDenied()

            formclass = _load_messaging_formclass(c)

    # Note! Sync with newsevents/backendviews.py
    formclass.no_incoming_processing = False
    formclass.verbose_name = 'messaging provider'
    formclass.verbose_name_plural = 'messaging providers'

    return backend_list_editor(
        request,
        None,
        formclass,
        rest,
        bypass_conference_filter=True,
        object_queryset=MessagingProvider.objects.filter(series=series),
        instancemaker=lambda: MessagingProvider(series=series),
        breadcrumbs=[
            ('/events/admin/', 'Series'),
            ('/events/admin/_series/{}/'.format(series.id), series.name),
        ])