This commit is contained in:
Yohann D'ANELLO 2020-03-27 00:40:35 +01:00
parent 841d56d5b3
commit 213e5a8369
4 changed files with 16 additions and 18 deletions

View File

@ -6,10 +6,11 @@ from django.urls import path
from . import views from . import views
app_name = 'activity' app_name = 'activity'
urlpatterns = [ urlpatterns = [
path('', views.ActivityListView.as_view(),name='activity_list'), path('', views.ActivityListView.as_view(), name='activity_list'),
path('<int:pk>/', views.ActivityDetailView.as_view(),name='activity_detail'), path('<int:pk>/', views.ActivityDetailView.as_view(), name='activity_detail'),
path('<int:pk>/entry/', views.ActivityEntryView.as_view(),name='activity_entry'), path('<int:pk>/entry/', views.ActivityEntryView.as_view(), name='activity_entry'),
path('<int:pk>/update/', views.ActivityUpdateView.as_view(),name='activity_update'), path('<int:pk>/update/', views.ActivityUpdateView.as_view(), name='activity_update'),
path('new/', views.ActivityCreateView.as_view(),name='activity_create'), path('new/', views.ActivityCreateView.as_view(), name='activity_create'),
] ]

View File

@ -1,33 +1,31 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay # Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from dal import autocomplete from django.views.generic import CreateView, DetailView, UpdateView, TemplateView
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 django_tables2.views import SingleTableView
from .models import Activity, ActivityType from .models import Activity
class ActivityCreateView(CreateView): class ActivityCreateView(CreateView):
model = Activity model = Activity
template_name = 'activity_create.html' template_name = 'activity_create.html'
class ActivityListView(SingleTableView): class ActivityListView(SingleTableView):
model = Activity model = Activity
template_name = 'activity_list.html' template_name = 'activity_list.html'
class ActivityDetailView(DetailView): class ActivityDetailView(DetailView):
model = Activity model = Activity
template_name = 'activty_detail.html' template_name = 'activty_detail.html'
class ActivityUpdateView(UpdateView): class ActivityUpdateView(UpdateView):
model = Activity model = Activity
template_name = 'activity_update.html' template_name = 'activity_update.html'
class ActivityEntryView(TemplateView): class ActivityEntryView(TemplateView):
pass pass

View File

@ -23,7 +23,6 @@ urlpatterns = [
path('i18n/', include('django.conf.urls.i18n')), path('i18n/', include('django.conf.urls.i18n')),
path('admin/doc/', include('django.contrib.admindocs.urls')), path('admin/doc/', include('django.contrib.admindocs.urls')),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('accounts/', include('member.urls')),
path('accounts/login/', CustomLoginView.as_view()), path('accounts/login/', CustomLoginView.as_view()),
path('accounts/', include('django.contrib.auth.urls')), path('accounts/', include('django.contrib.auth.urls')),
path('api/', include('api.urls')), path('api/', include('api.urls')),