Skip to content
Snippets Groups Projects
views.py 861 B
Newer Older
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later

ynerant's avatar
ynerant committed
from django.views.generic import CreateView, DetailView, UpdateView, TemplateView
ynerant's avatar
ynerant committed
from django.utils.translation import gettext_lazy as _
from django_tables2.views import SingleTableView

ynerant's avatar
ynerant committed
from .forms import ActivityForm
ynerant's avatar
ynerant committed
from .models import Activity


class ActivityCreateView(CreateView):
    model = Activity
ynerant's avatar
ynerant committed
    form_class = ActivityForm
ynerant's avatar
ynerant committed


class ActivityListView(SingleTableView):
    model = Activity
ynerant's avatar
ynerant committed

    def get_context_data(self, **kwargs):
        ctx = super().get_context_data(**kwargs)

        ctx['title'] = _("Upcoming activities")

        return ctx
ynerant's avatar
ynerant committed

class ActivityDetailView(DetailView):
    model = Activity

ynerant's avatar
ynerant committed

class ActivityUpdateView(UpdateView):
    model = Activity
ynerant's avatar
ynerant committed
    form_class = ActivityForm
ynerant's avatar
ynerant committed


class ActivityEntryView(TemplateView):
    pass