From d5f718fbba47e9f804a7704b0a01b0dc89082daf Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sun, 1 Mar 2020 17:16:38 +0100 Subject: [PATCH] start activity view and urls --- apps/activity/urls.py | 15 ++++++++++++ apps/activity/views.py | 33 +++++++++++++++++++++++++++ note_kfet/urls.py | 3 ++- templates/activity/activity_list.html | 26 +++++++++++++++++++++ templates/base.html | 2 +- 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 apps/activity/urls.py create mode 100644 apps/activity/views.py create mode 100644 templates/activity/activity_list.html diff --git a/apps/activity/urls.py b/apps/activity/urls.py new file mode 100644 index 00000000..125ac7af --- /dev/null +++ b/apps/activity/urls.py @@ -0,0 +1,15 @@ +# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + +from django.urls import path + +from . import views + +app_name = 'activity' +urlpatterns = [ + path('', views.ActivityListView.as_view(),name='activity_list'), + path('/', views.ActivityDetailView.as_view(),name='activity_detail'), + path('/entry/', views.ActivityEntryView.as_view(),name='activity_entry'), + path('/update/', views.ActivityUpdateView.as_view(),name='activity_update'), + path('new/', views.ActivityCreateView.as_view(),name='activity_create'), +] diff --git a/apps/activity/views.py b/apps/activity/views.py new file mode 100644 index 00000000..7ea61d2e --- /dev/null +++ b/apps/activity/views.py @@ -0,0 +1,33 @@ +# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + +from dal import autocomplete +from django.contrib.auth.mixins import LoginRequiredMixin +from django.db.models import Q +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ +from django.views.generic import CreateView, DetailView,\ + ListView, UpdateView, TemplateView +from django_tables2.views import SingleTableView + +from .models import Activity, ActivityType + +class ActivityCreateView(CreateView): + model = Activity + template_name = 'activity_create.html' + +class ActivityListView(SingleTableView): + model = Activity + template_name = 'activity_list.html' + +class ActivityDetailView(DetailView): + model = Activity + template_name = 'activty_detail.html' + +class ActivityUpdateView(UpdateView): + model = Activity + template_name = 'activity_update.html' + +class ActivityEntryView(TemplateView): + pass + diff --git a/note_kfet/urls.py b/note_kfet/urls.py index 303e229a..79b6dba6 100644 --- a/note_kfet/urls.py +++ b/note_kfet/urls.py @@ -11,10 +11,11 @@ urlpatterns = [ # Include project routers path('note/', include('note.urls')), + path('accounts/', include('member.urls')), + path('activity/', include('activity.urls')), # Include Django Contrib and Core routers path('i18n/', include('django.conf.urls.i18n')), - path('accounts/', include('member.urls')), path('accounts/', include('django.contrib.auth.urls')), path('admin/doc/', include('django.contrib.admindocs.urls')), path('admin/', admin.site.urls), diff --git a/templates/activity/activity_list.html b/templates/activity/activity_list.html new file mode 100644 index 00000000..7f682d4c --- /dev/null +++ b/templates/activity/activity_list.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% load render_table from django_tables2 %} +{% load i18n crispy_forms_tags%} +{% block content %} + +{% trans 'New activity' %} + +
+
+ {% render_table table %} +
+
+ +{% endblock %} + +{% block extrajavascript %} + +{% endblock %} diff --git a/templates/base.html b/templates/base.html index 6814bedf..c0d4c43b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -73,7 +73,7 @@ SPDX-License-Identifier: GPL-3.0-or-later Clubs