mirror of https://gitlab.crans.org/bde/nk20
start activity view and urls
This commit is contained in:
parent
f1cedc902e
commit
d5f718fbba
|
@ -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('<int:pk>/', views.ActivityDetailView.as_view(),name='activity_detail'),
|
||||||
|
path('<int:pk>/entry/', views.ActivityEntryView.as_view(),name='activity_entry'),
|
||||||
|
path('<int:pk>/update/', views.ActivityUpdateView.as_view(),name='activity_update'),
|
||||||
|
path('new/', views.ActivityCreateView.as_view(),name='activity_create'),
|
||||||
|
]
|
|
@ -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
|
||||||
|
|
|
@ -11,10 +11,11 @@ urlpatterns = [
|
||||||
|
|
||||||
# Include project routers
|
# Include project routers
|
||||||
path('note/', include('note.urls')),
|
path('note/', include('note.urls')),
|
||||||
|
path('accounts/', include('member.urls')),
|
||||||
|
path('activity/', include('activity.urls')),
|
||||||
|
|
||||||
# Include Django Contrib and Core routers
|
# Include Django Contrib and Core routers
|
||||||
path('i18n/', include('django.conf.urls.i18n')),
|
path('i18n/', include('django.conf.urls.i18n')),
|
||||||
path('accounts/', include('member.urls')),
|
|
||||||
path('accounts/', include('django.contrib.auth.urls')),
|
path('accounts/', include('django.contrib.auth.urls')),
|
||||||
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),
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load render_table from django_tables2 %}
|
||||||
|
{% load i18n crispy_forms_tags%}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<a class="btn btn-primary" href="{% url 'activity:activity_create' %}">{% trans 'New activity' %}</a>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div id="replaceable-content" class="col-6">
|
||||||
|
{% render_table table %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extrajavascript %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function($) {
|
||||||
|
$(".table-row").click(function() {
|
||||||
|
window.document.location = $(this).data("href");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
|
@ -73,7 +73,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
<a class="nav-link" href="{% url 'member:club_list' %}"><i class="fa fa-users"></i> Clubs</a>
|
<a class="nav-link" href="{% url 'member:club_list' %}"><i class="fa fa-users"></i> Clubs</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item active">
|
<li class="nav-item active">
|
||||||
<a class="nav-link" href="#"><i class="fa fa-calendar"></i> Activités</a>
|
<a class="nav-link" href="{% url 'activity:activity_list' %}"><i class="fa fa-calendar"></i> Activités</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item active">
|
<li class="nav-item active">
|
||||||
<a class="nav-link" href="{% url 'note:template_list' %}"><i class="fa fa-coffee"></i> Bouton</a>
|
<a class="nav-link" href="{% url 'note:template_list' %}"><i class="fa fa-coffee"></i> Bouton</a>
|
||||||
|
|
Loading…
Reference in New Issue