Compare commits

...

7 commits

Author SHA1 Message Date
Martin Pépin 5f167f39a3 BDS members CSV export 2020-05-08 23:42:29 +02:00
Martin Pépin e025ae2d96 BDS: members email export 2020-05-08 23:41:41 +02:00
Martin Pépin 3b98f35773 Only BDS staff has access to GestioBDS 2020-05-08 23:34:34 +02:00
Martin Pépin 5983a55950 Make black happy 2020-05-08 18:16:44 +02:00
Martin Pépin b32eb96fc7 Minor BDS model updates wanted by the BDS staff 2020-05-08 18:10:09 +02:00
Evarin 8ee173cd8c CSS pour home gestioBDS 2020-05-08 18:10:09 +02:00
Martin Pépin 02958b4866 Very simple home page for the BDS 2020-05-08 18:10:09 +02:00
11 changed files with 377 additions and 10 deletions

View file

@ -0,0 +1,21 @@
# Generated by Django 2.2.12 on 2020-05-08 14:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bds", "0004_is_member_cotiz_type"),
]
operations = [
migrations.RemoveField(model_name="bdsprofile", name="FFSU_number",),
migrations.AlterField(
model_name="bdsprofile",
name="certificate_file",
field=models.BooleanField(
default=False, verbose_name="fichier de certificat médical"
),
),
]

View file

@ -65,18 +65,13 @@ class BDSProfile(models.Model):
mails_bds = models.BooleanField(_("recevoir les mails du BDS"), default=False)
has_certificate = models.BooleanField(_("certificat médical"), default=False)
certificate_file = models.FileField(
_("fichier de certificat médical"),
upload_to=get_certificate_filename,
blank=True,
certificate_file = models.BooleanField(
_("fichier de certificat médical"), default=False
)
ASPSL_number = models.CharField(
_("numéro AS PSL"), max_length=50, blank=True, null=True
)
FFSU_number = models.CharField(
_("numéro FFSU"), max_length=50, blank=True, null=True
)
is_member = models.BooleanField(_("adhérent⋅e du BDS"), default=False)
cotisation_period = models.CharField(

25
bds/static/bds/config.rb Normal file
View file

@ -0,0 +1,25 @@
require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass

View file

@ -0,0 +1,92 @@
@import url("https://fonts.googleapis.com/css?family=Muli:400,700&display=swap");
/* line 9, ../sass/bds.scss */
html {
font-family: Muli, sans-serif;
height: 100%;
color: black;
}
/* line 15, ../sass/bds.scss */
body {
margin: 0;
background: #DC004E;
height: 100%;
}
/* line 21, ../sass/bds.scss */
header {
background-color: #76002a;
height: 75px;
}
/* line 26, ../sass/bds.scss */
h1 {
text-align: center;
color: #FBE000;
line-height: 75px;
margin: 0;
}
/* line 33, ../sass/bds.scss */
h2 {
text-align: center;
background-color: #ffee62;
padding: 10px 0;
margin: 0;
border-bottom: 1px solid #0767A0;
}
/* line 41, ../sass/bds.scss */
li {
list-style: none;
margin-bottom: 5px;
}
/* line 46, ../sass/bds.scss */
a {
color: black;
text-decoration: none;
}
/* line 51, ../sass/bds.scss */
a:hover {
color: #011f32;
text-decoration: underline;
}
/* line 56, ../sass/bds.scss */
#main-container {
display: flex;
flex-flow: column wrap;
font-size: large;
min-height: calc(100vh - 50px - 75px);
}
/* line 63, ../sass/bds.scss */
section {
display: flex;
flex-flow: row wrap;
width: 100%;
max-width: 800px;
margin: 0 auto;
flex-wrap: wrap;
}
/* line 72, ../sass/bds.scss */
article {
flex: 1;
margin: 30px;
/* background: #90baad; */
background: #FFF9CB;
min-width: 300px;
}
/* line 80, ../sass/bds.scss */
footer {
text-align: center;
line-height: 50px;
height: 50px;
background-color: #76002a;
color: #f0f0f0;
width: 100%;
}

View file

@ -0,0 +1,87 @@
@import url('https://fonts.googleapis.com/css?family=Muli:400,700&display=swap');
$main: #DC004E;
$aux1: #FBE000;
$aux2: #0767A0;
$white: #FFF9CB;
$black: darken(#013352, 20%);
html {
font-family: Muli, sans-serif;
height: 100%;
color: $black;
}
body {
margin: 0;
background: $main;
height: 100%;
}
header {
background-color: darken($main, 20%);
height: 75px;
}
h1 {
text-align: center;
color: $aux1;
line-height: 75px;
margin: 0;
}
h2 {
text-align: center;
background-color: lighten($aux1, 20%);
padding: 10px 0;
margin: 0;
border-bottom: 1px solid $aux2;
}
li {
list-style: none;
margin-bottom: 5px;
}
a {
color: black;
text-decoration: none;
}
a:hover {
color: lighten($black, 10%);
text-decoration: underline;
}
#main-container {
display: flex;
flex-flow: column wrap;
font-size: large;
min-height: calc(100vh - 50px - 75px);
}
section {
display: flex;
flex-flow: row wrap;
width: 100%;
max-width: 800px;
margin: 0 auto;
flex-wrap: wrap;
}
article {
flex: 1;
margin: 30px;
/* background: #90baad; */
background: $white;
min-width: 300px;
}
footer {
text-align: center;
line-height: 50px;
height: 50px;
background-color: darken($main, 20%);
color: #f0f0f0;
width: 100%;
}

View file

@ -0,0 +1,30 @@
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<title>GestioBDS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="text/css" rel="stylesheet" href="{% static 'bds/css/bds.css' %}" />
{% block extra_head %}{% endblock %}
</head>
<body>
<header class="header">
<h1>GestioBDS</h1>
</header>
{% block content %}{% endblock %}
<footer class="footer">
Développé par <a href="https://www.eleves.ens.fr/kde">KDEns</a> -
Pour tout problème&#8239;:
<a href="mailto:klub-dev@ens.fr"><tt>klub-dev@ens.fr</tt></a>
</footer>
</body>
</html>

View file

@ -0,0 +1,42 @@
{% extends "bds/base.html" %}
{% block content %}
<div id="main-container">
<section>
<article>
<h2>Gestion des membres</h2>
<ul>
<li><a href="#todo">Chercher une personne</a></li>
<li><a href="{% url 'bds:members_emails' %}">Emails des adhérent⋅e⋅s</a></li>
<li><a href="{% url 'bds:members_csv' %}">Export CSV des adhérent⋅e⋅s</a></li>
</ul>
</article>
</section>
<section class="section columns">
<article>
<h2>Gestion des clubs</h2>
<ul>
<li>Club 1</li>
<li>Club 2</li>
<li>Club 3</li>
<li>Club 4</li>
</ul>
</article>
<article>
<h2>Événements</h2>
<ul>
<li>Événement 1</li>
<li>Événement 2</li>
<li>Événement 3</li>
<li>Événement 4</li>
</ul>
</article>
</section>
</div>
{% endblock %}

11
bds/urls.py Normal file
View file

@ -0,0 +1,11 @@
from django.urls import path
from bds import views
app_name = "bds"
urlpatterns = [
path("", views.home, name="home"),
path("members/emails", views.members_emails, name="members_emails"),
path("members/csv", views.members_csv, name="members_csv"),
]

View file

@ -1 +1,60 @@
# Create your views here.
import csv
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.http import HttpResponse
from django.views.generic import TemplateView
from bds.models import BDSProfile
class HomeView(PermissionRequiredMixin, TemplateView):
permission_required = "bds:is_team"
template_name = "bds/home.html"
home = HomeView.as_view()
@permission_required("bds:is_staff")
def members_emails(request):
members = BDSProfile.objects.filter(is_member=True)
response = HttpResponse(content_type="text/plain")
response.write(", ".join(members.values_list("user__email", flat=True)))
return response
@permission_required("bds:is_staff")
def members_csv(request):
response = HttpResponse(content_type="text/csv")
response["Content-Disposition"] = 'attachment; filename="members.csv"'
writer = csv.writer(response)
header = [
"nom",
"email",
"numéro de téléphone",
"occupation",
"département",
"date de naissance",
"Numéro ASPSL",
"Période de cotisation",
"Type de cotisation",
]
writer.writerow(header)
for profile in BDSProfile.objects.filter(is_member=True):
data = [
profile.user.get_full_name(),
profile.user.email,
profile.phone,
profile.occupation,
profile.departement,
profile.birthdate,
profile.ASPSL_number,
profile.cotisation_period,
profile.cotisation_type,
]
writer.writerow(map(lambda x: str(x) if x else "", data))
return response

View file

@ -2,4 +2,8 @@ from django.contrib.staticfiles.apps import StaticFilesConfig
class IgnoreSrcStaticFilesConfig(StaticFilesConfig):
ignore_patterns = StaticFilesConfig.ignore_patterns + ["src/**"]
ignore_patterns = StaticFilesConfig.ignore_patterns + [
"src/**",
"config.rb",
"sass/",
]

View file

@ -8,7 +8,6 @@ from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as django_auth_views
from django.urls import include, path
from django.views.decorators.cache import cache_page
from django.views.generic.base import TemplateView
from django_cas_ng import views as django_cas_views
from django_js_reverse.views import urls_js
@ -33,6 +32,8 @@ urlpatterns = [
path("", gestioncof_views.HomeView.as_view(), name="home"),
# Le BdA
path("bda/", include("bda.urls")),
# Le BDS
path("bds/", include("bds.urls")),
# Les exports
path("export/", include(export_patterns)),
# Les petits cours