com: add agenda on news page

Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
Skia 2017-09-01 12:22:38 +02:00
parent 0532f7337a
commit 4edb9a78c6
3 changed files with 146 additions and 93 deletions

View File

@ -17,6 +17,23 @@ section.news_call, section.news_notice {
section.news_event:nth-of-type(even) { section.news_event:nth-of-type(even) {
background: lightblue; background: lightblue;
} }
div#agenda {
display: block;
width: 20%;
float: right;
background: white;
font-size: 70%;
border: solid 1px darkgrey;
padding: 0.5em;
}
div#agenda_content {
overflow: auto;
width: 100%;
height: 20em;
}
.news_weekly p {
margin: 0.2em;
}
.date { .date {
font-size: small; font-size: small;
color: grey; color: grey;
@ -29,6 +46,28 @@ section.news_event:nth-of-type(even) {
{% if user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) %} {% if user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) %}
<a href="{{ url('com:news_admin_list') }}">{% trans %}Administrate news{% endtrans %}</a> <a href="{{ url('com:news_admin_list') }}">{% trans %}Administrate news{% endtrans %}</a>
{% endif %} {% endif %}
<div id="agenda">
<h4>{% trans %}Agenda{% endtrans %}</h4>
<hr>
<div id="agenda_content">
{% for d in NewsDate.objects.filter(end_date__gte=timezone.now(),
news__is_moderated=True, news__type__in=["WEEKLY",
"EVENT"]).order_by('start_date', 'end_date') %}
<section class="news_weekly">
<p><strong>{{ d.start_date|localtime|date('D d M Y') }}</strong></p>
<p class="date">
<span>{{ d.start_date|localtime|time(DATETIME_FORMAT) }}</span> -
<span>{{ d.end_date|localtime|time(DATETIME_FORMAT) }}</span>
</p>
<p><strong><a href="{{ url('com:news_detail', news_id=d.news.id) }}">{{ d.news.title }}</a></strong>
<a href="{{ d.news.club.get_absolute_url() }}">{{ d.news.club }}</a></p>
<p>{{ d.news.summary|markdown }}</p>
</section>
{% endfor %}
</div>
</div>
{% for news in object_list.filter(type="NOTICE") %} {% for news in object_list.filter(type="NOTICE") %}
<section class="news_notice"> <section class="news_notice">
<h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a></h4> <h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a></h4>
@ -67,9 +106,9 @@ section.news_event:nth-of-type(even) {
</section> </section>
{% endfor %} {% endfor %}
<hr> <hr>
<h4>{% trans %}Coming soon... don't miss!{% endtrans %}</h4>
{% endfor %} {% endfor %}
{% for news in object_list.filter(dates__start_date__gte=timezone.now()+timedelta(days=5), type="EVENT") %} <h4>{% trans %}Coming soon... don't miss!{% endtrans %}</h4>
{% for news in object_list.filter(dates__start_date__gte=timezone.now()+timedelta(days=5), type="EVENT", is_moderated=True) %}
<section> <section>
<h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a> <h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a>
<span class="date">{{ news.dates.first().start_date|localtime|date(DATETIME_FORMAT) }} <span class="date">{{ news.dates.first().start_date|localtime|date(DATETIME_FORMAT) }}
@ -79,26 +118,6 @@ section.news_event:nth-of-type(even) {
</h4> </h4>
</section> </section>
{% endfor %} {% endfor %}
<!--
<hr>
<h4>{% trans %}Weekly{% endtrans %}</h4>
{% for news in object_list.filter(dates__end_date__gte=timezone.now(), type="WEEKLY").distinct() %}
buggy when more than one news, anyway, we won't use it this way
{% for d in news.dates.all() %}
<section class="news_weekly">
<h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a></h4>
<p class="date">
<span>{{ d.start_date|localtime|date(DATETIME_FORMAT) }}
{{ d.start_date|localtime|time(DATETIME_FORMAT) }}</span> -
<span>{{ d.end_date|localtime|date(DATETIME_FORMAT) }}
{{ d.end_date|localtime|time(DATETIME_FORMAT) }}</span>
</p>
<p><a href="{{ news.club.get_absolute_url() }}">{{ news.club }}</a></p>
<p>{{ news.summary|markdown }}</p>
</section>
{% endfor %}
{% endfor %}
-->
{% endblock %} {% endblock %}

View File

@ -23,7 +23,7 @@
# #
import os import os
from datetime import date, datetime from datetime import date, datetime, timedelta
from io import StringIO, BytesIO from io import StringIO, BytesIO
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
@ -31,6 +31,7 @@ from django.core.management import call_command
from django.conf import settings from django.conf import settings
from django.db import connection from django.db import connection
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.utils import timezone
from PIL import Image from PIL import Image
@ -40,7 +41,7 @@ from core.utils import resize_image
from club.models import Club, Membership from club.models import Club, Membership
from subscription.models import Subscription from subscription.models import Subscription
from counter.models import Customer, ProductType, Product, Counter, Selling from counter.models import Customer, ProductType, Product, Counter, Selling
from com.models import Sith, Weekmail from com.models import Sith, Weekmail, News, NewsDate
from election.models import Election, Role, Candidature, ElectionList from election.models import Election, Role, Candidature, ElectionList
from forum.models import Forum, ForumTopic from forum.models import Forum, ForumTopic
@ -534,3 +535,33 @@ Welcome to the wiki page!
various.save() various.save()
Forum(name="Promos", description="Réservé aux Promos", parent=various).save() Forum(name="Promos", description="Réservé aux Promos", parent=various).save()
ForumTopic(forum=hall) ForumTopic(forum=hall)
# News
friday = timezone.now()
while friday.weekday() != 4:
friday += timedelta(hours=6)
friday.replace(hour=20, minute=0, second=0)
# Event
n = News(title="Repas barman", summary="Enjoy la fin du semestre!",
content="Viens donc t'enjailler avec les autres barmans aux "
"frais du BdF! \o/", type="EVENT", club=bar_club,
author=subscriber, is_moderated=True, moderator=skia)
n.save()
NewsDate(news=n, start_date=timezone.now()+timedelta(hours=72),
end_date=timezone.now()+timedelta(hours=84)).save()
n = News(title="SdF", summary="Enjoy la fin des finaux!",
content="Viens faire la fête avec tout plein de gens!",
type="EVENT", club=bar_club, author=subscriber,
is_moderated=True, moderator=skia)
n.save()
NewsDate(news=n, start_date=friday+timedelta(hours=24*7+1),
end_date=timezone.now()+timedelta(hours=24*7+9)).save()
# Weekly
n = News(title="Jeux sans faim", summary="Viens jouer!",
content="Rejoins la fine équipe du Troll Penché et viens "
"d'amuser le Vendredi soir!", type="WEEKLY", club=troll,
author=subscriber, is_moderated=True, moderator=skia)
n.save()
for i in range(10):
NewsDate(news=n, start_date=friday+timedelta(hours=24*7*i),
end_date=friday+timedelta(hours=24*7*i+8)).save()

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-31 15:27+0200\n" "POT-Creation-Date: 2017-09-01 12:11+0200\n"
"PO-Revision-Date: 2016-07-18\n" "PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n" "Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n" "Language-Team: AE info <ae.info@utbm.fr>\n"
@ -216,7 +216,7 @@ msgstr "Compte"
msgid "Company" msgid "Company"
msgstr "Entreprise" msgstr "Entreprise"
#: accounting/models.py:271 sith/settings.py:367 #: accounting/models.py:271 sith/settings.py:368
#: stock/templates/stock/shopping_list_items.jinja:37 #: stock/templates/stock/shopping_list_items.jinja:37
msgid "Other" msgid "Other"
msgstr "Autre" msgstr "Autre"
@ -1240,7 +1240,7 @@ msgstr "Information"
msgid "Event" msgid "Event"
msgstr "Événement" msgstr "Événement"
#: com/models.py:54 com/templates/com/news_list.jinja:84 #: com/models.py:54
msgid "Weekly" msgid "Weekly"
msgstr "Hebdomadaire" msgstr "Hebdomadaire"
@ -1356,7 +1356,7 @@ msgstr "Administration des nouvelles"
#: com/templates/com/news_admin_list.jinja:9 #: com/templates/com/news_admin_list.jinja:9
#: com/templates/com/news_detail.jinja:5 com/templates/com/news_detail.jinja:11 #: com/templates/com/news_detail.jinja:5 com/templates/com/news_detail.jinja:11
#: com/templates/com/news_list.jinja:4 com/templates/com/news_list.jinja:28 #: com/templates/com/news_list.jinja:4 com/templates/com/news_list.jinja:42
msgid "News" msgid "News"
msgstr "Nouvelles" msgstr "Nouvelles"
@ -1534,15 +1534,19 @@ msgstr ""
msgid "Preview" msgid "Preview"
msgstr "Prévisualiser" msgstr "Prévisualiser"
#: com/templates/com/news_list.jinja:30 #: com/templates/com/news_list.jinja:44
msgid "Administrate news" msgid "Administrate news"
msgstr "Administrer les news" msgstr "Administrer les news"
#: com/templates/com/news_list.jinja:51 #: com/templates/com/news_list.jinja:48
msgid "Agenda"
msgstr "Agenda"
#: com/templates/com/news_list.jinja:85
msgid "Events today and the next few days" msgid "Events today and the next few days"
msgstr "Événement aujourd'hui et dans les prochains jours" msgstr "Événement aujourd'hui et dans les prochains jours"
#: com/templates/com/news_list.jinja:70 #: com/templates/com/news_list.jinja:105
msgid "Coming soon... don't miss!" msgid "Coming soon... don't miss!"
msgstr "Prochainement... à ne pas rater!" msgstr "Prochainement... à ne pas rater!"
@ -3176,7 +3180,7 @@ msgstr "Bureau"
#: eboutic/templates/eboutic/eboutic_main.jinja:24 #: eboutic/templates/eboutic/eboutic_main.jinja:24
#: eboutic/templates/eboutic/eboutic_makecommand.jinja:8 #: eboutic/templates/eboutic/eboutic_makecommand.jinja:8
#: eboutic/templates/eboutic/eboutic_payment_result.jinja:4 #: eboutic/templates/eboutic/eboutic_payment_result.jinja:4
#: sith/settings.py:366 sith/settings.py:374 #: sith/settings.py:367 sith/settings.py:375
msgid "Eboutic" msgid "Eboutic"
msgstr "Eboutic" msgstr "Eboutic"
@ -3217,8 +3221,8 @@ msgstr "quantité"
msgid "Sith account" msgid "Sith account"
msgstr "Compte utilisateur" msgstr "Compte utilisateur"
#: counter/models.py:351 sith/settings.py:359 sith/settings.py:364 #: counter/models.py:351 sith/settings.py:360 sith/settings.py:365
#: sith/settings.py:386 #: sith/settings.py:387
msgid "Credit card" msgid "Credit card"
msgstr "Carte bancaire" msgstr "Carte bancaire"
@ -4077,12 +4081,12 @@ msgid "Washing and drying"
msgstr "Lavage et séchage" msgstr "Lavage et séchage"
#: launderette/templates/launderette/launderette_book.jinja:27 #: launderette/templates/launderette/launderette_book.jinja:27
#: sith/settings.py:541 #: sith/settings.py:547
msgid "Washing" msgid "Washing"
msgstr "Lavage" msgstr "Lavage"
#: launderette/templates/launderette/launderette_book.jinja:31 #: launderette/templates/launderette/launderette_book.jinja:31
#: sith/settings.py:541 #: sith/settings.py:547
msgid "Drying" msgid "Drying"
msgstr "Séchage" msgstr "Séchage"
@ -4257,230 +4261,229 @@ msgstr "Erreur de création de l'album %(album)s : %(msg)s"
msgid "Add user" msgid "Add user"
msgstr "Ajouter une personne" msgstr "Ajouter une personne"
#: sith/settings.py:211 #: sith/settings.py:212
msgid "English" msgid "English"
msgstr "Anglais" msgstr "Anglais"
#: sith/settings.py:212 #: sith/settings.py:213
msgid "French" msgid "French"
msgstr "Français" msgstr "Français"
#: sith/settings.py:340 #: sith/settings.py:341
msgid "TC" msgid "TC"
msgstr "TC" msgstr "TC"
#: sith/settings.py:341 #: sith/settings.py:342
msgid "IMSI" msgid "IMSI"
msgstr "IMSI" msgstr "IMSI"
#: sith/settings.py:342 #: sith/settings.py:343
msgid "IMAP" msgid "IMAP"
msgstr "IMAP" msgstr "IMAP"
#: sith/settings.py:343 #: sith/settings.py:344
msgid "INFO" msgid "INFO"
msgstr "INFO" msgstr "INFO"
#: sith/settings.py:344 #: sith/settings.py:345
msgid "GI" msgid "GI"
msgstr "GI" msgstr "GI"
#: sith/settings.py:345 #: sith/settings.py:346
msgid "E" msgid "E"
msgstr "E" msgstr "E"
#: sith/settings.py:346 #: sith/settings.py:347
msgid "EE" msgid "EE"
msgstr "EE" msgstr "EE"
#: sith/settings.py:347 #: sith/settings.py:348
msgid "GESC" msgid "GESC"
msgstr "GESC" msgstr "GESC"
#: sith/settings.py:348 #: sith/settings.py:349
msgid "GMC" msgid "GMC"
msgstr "GMC" msgstr "GMC"
#: sith/settings.py:349 #: sith/settings.py:350
msgid "MC" msgid "MC"
msgstr "MC" msgstr "MC"
#: sith/settings.py:350 #: sith/settings.py:351
msgid "EDIM" msgid "EDIM"
msgstr "EDIM" msgstr "EDIM"
#: sith/settings.py:351 #: sith/settings.py:352
msgid "Humanities" msgid "Humanities"
msgstr "Humanités" msgstr "Humanités"
#: sith/settings.py:352 #: sith/settings.py:353
msgid "N/A" msgid "N/A"
msgstr "N/A" msgstr "N/A"
#: sith/settings.py:356 sith/settings.py:363 sith/settings.py:384 #: sith/settings.py:357 sith/settings.py:364 sith/settings.py:385
msgid "Check" msgid "Check"
msgstr "Chèque" msgstr "Chèque"
#: sith/settings.py:357 sith/settings.py:365 sith/settings.py:385 #: sith/settings.py:358 sith/settings.py:366 sith/settings.py:386
msgid "Cash" msgid "Cash"
msgstr "Espèces" msgstr "Espèces"
#: sith/settings.py:358 #: sith/settings.py:359
msgid "Transfert" msgid "Transfert"
msgstr "Virement" msgstr "Virement"
#: sith/settings.py:371 #: sith/settings.py:372
msgid "Belfort" msgid "Belfort"
msgstr "Belfort" msgstr "Belfort"
#: sith/settings.py:372 #: sith/settings.py:373
msgid "Sevenans" msgid "Sevenans"
msgstr "Sevenans" msgstr "Sevenans"
#: sith/settings.py:373 #: sith/settings.py:374
msgid "Montbéliard" msgid "Montbéliard"
msgstr "Montbéliard" msgstr "Montbéliard"
#: sith/settings.py:428 #: sith/settings.py:429
msgid "One semester" msgid "One semester"
msgstr "Un semestre, 15 €" msgstr "Un semestre, 15 €"
#: sith/settings.py:433 #: sith/settings.py:434
msgid "Two semesters" msgid "Two semesters"
msgstr "Deux semestres, 28 €" msgstr "Deux semestres, 28 €"
#: sith/settings.py:438 #: sith/settings.py:439
msgid "Common core cursus" msgid "Common core cursus"
msgstr "Cursus tronc commun, 45 €" msgstr "Cursus tronc commun, 45 €"
#: sith/settings.py:443 #: sith/settings.py:444
msgid "Branch cursus" msgid "Branch cursus"
msgstr "Cursus branche, 45 €" msgstr "Cursus branche, 45 €"
#: sith/settings.py:448 #: sith/settings.py:449
msgid "Alternating cursus" msgid "Alternating cursus"
msgstr "Cursus alternant, 30 €" msgstr "Cursus alternant, 30 €"
#: sith/settings.py:453 #: sith/settings.py:454
msgid "Honorary member" msgid "Honorary member"
msgstr "Membre honoraire, 0 €" msgstr "Membre honoraire, 0 €"
#: sith/settings.py:458 #: sith/settings.py:459
msgid "Assidu member" msgid "Assidu member"
msgstr "Membre d'Assidu, 0 €" msgstr "Membre d'Assidu, 0 €"
#: sith/settings.py:463 #: sith/settings.py:464
msgid "Amicale/DOCEO member" msgid "Amicale/DOCEO member"
msgstr "Membre de l'Amicale/DOCEO, 0 €" msgstr "Membre de l'Amicale/DOCEO, 0 €"
#: sith/settings.py:468 #: sith/settings.py:469
msgid "UT network member" msgid "UT network member"
msgstr "Cotisant du réseau UT, 0 €" msgstr "Cotisant du réseau UT, 0 €"
#: sith/settings.py:473 #: sith/settings.py:474
msgid "CROUS member" msgid "CROUS member"
msgstr "Membres du CROUS, 0 €" msgstr "Membres du CROUS, 0 €"
#: sith/settings.py:478 #: sith/settings.py:479
msgid "Sbarro/ESTA member" msgid "Sbarro/ESTA member"
msgstr "Membre de Sbarro ou de l'ESTA, 15 €" msgstr "Membre de Sbarro ou de l'ESTA, 15 €"
#: sith/settings.py:483 #: sith/settings.py:484
msgid "One semester Welcome Week" msgid "One semester Welcome Week"
msgstr "Un semestre Welcome Week" msgstr "Un semestre Welcome Week"
#: sith/settings.py:513 #: sith/settings.py:489
msgid "Two month for free" msgid "Two month for free"
msgstr "Deux mois gratuits" msgstr "Deux mois gratuits"
#: sith/settings.py:510 #: sith/settings.py:511
msgid "President" msgid "President"
msgstr "Président" msgstr "Président"
#: sith/settings.py:511 #: sith/settings.py:512
msgid "Vice-President" msgid "Vice-President"
msgstr "Vice-Président" msgstr "Vice-Président"
#: sith/settings.py:512 #: sith/settings.py:513
msgid "Treasurer" msgid "Treasurer"
msgstr "Trésorier" msgstr "Trésorier"
#: sith/settings.py:513 #: sith/settings.py:514
msgid "Communication supervisor" msgid "Communication supervisor"
msgstr "Responsable communication" msgstr "Responsable communication"
#: sith/settings.py:514 #: sith/settings.py:515
msgid "Secretary" msgid "Secretary"
msgstr "Secrétaire" msgstr "Secrétaire"
#: sith/settings.py:515 #: sith/settings.py:516
msgid "IT supervisor" msgid "IT supervisor"
msgstr "Responsable info" msgstr "Responsable info"
#: sith/settings.py:516 #: sith/settings.py:517
msgid "Board member" msgid "Board member"
msgstr "Membre du bureau" msgstr "Membre du bureau"
#: sith/settings.py:517 #: sith/settings.py:518
msgid "Active member" msgid "Active member"
msgstr "Membre actif" msgstr "Membre actif"
#: sith/settings.py:517 #: sith/settings.py:519
msgid "Curious" msgid "Curious"
msgstr "Curieux" msgstr "Curieux"
#: sith/settings.py:548 #: sith/settings.py:554
msgid "A new mailing list needs to be moderated" msgid "A new mailing list needs to be moderated"
msgstr "Une nouvelle mailing list a besoin d'être modérée" msgstr "Une nouvelle mailing list a besoin d'être modérée"
#: sith/settings.py:549 #: sith/settings.py:555
msgid "A fresh new to be moderated" msgid "A fresh new to be moderated"
msgstr "Une nouvelle toute neuve à modérer" msgstr "Une nouvelle toute neuve à modérer"
#: sith/settings.py:550 #: sith/settings.py:556
msgid "New files to be moderated" msgid "New files to be moderated"
msgstr "Nouveaux fichiers à modérer" msgstr "Nouveaux fichiers à modérer"
#: sith/settings.py:551 #: sith/settings.py:557
msgid "New pictures/album to be moderated in the SAS" msgid "New pictures/album to be moderated in the SAS"
msgstr "Nouvelles photos/albums à modérer dans le SAS" msgstr "Nouvelles photos/albums à modérer dans le SAS"
#: sith/settings.py:552 #: sith/settings.py:558
msgid "You've been identified on some pictures" msgid "You've been identified on some pictures"
msgstr "Vous avez été identifié sur des photos" msgstr "Vous avez été identifié sur des photos"
#: sith/settings.py:558 #: sith/settings.py:559
#, python-format #, python-format
msgid "You just refilled of %s €" msgid "You just refilled of %s €"
msgstr "Vous avez rechargé votre compte de %s €" msgstr "Vous avez rechargé votre compte de %s €"
#: sith/settings.py:554 #: sith/settings.py:560
#, python-format #, python-format
msgid "You just bought %s" msgid "You just bought %s"
msgstr "Vous avez acheté %s" msgstr "Vous avez acheté %s"
#: sith/settings.py:563 #: sith/settings.py:561
#: sith/settings.py:560
msgid "You have a notification" msgid "You have a notification"
msgstr "Vous avez une notification" msgstr "Vous avez une notification"
#: sith/settings.py:564 #: sith/settings.py:565
msgid "Success!" msgid "Success!"
msgstr "Succès !" msgstr "Succès !"
#: sith/settings.py:565 #: sith/settings.py:566
msgid "Fail!" msgid "Fail!"
msgstr "Échec !" msgstr "Échec !"
#: sith/settings.py:566 #: sith/settings.py:567
msgid "You successfully posted an article in the Weekmail" msgid "You successfully posted an article in the Weekmail"
msgstr "Article posté avec succès dans le Weekmail" msgstr "Article posté avec succès dans le Weekmail"
#: sith/settings.py:567 #: sith/settings.py:568
msgid "You successfully edited an article in the Weekmail" msgid "You successfully edited an article in the Weekmail"
msgstr "Article édité avec succès dans le Weekmail" msgstr "Article édité avec succès dans le Weekmail"
#: sith/settings.py:568 #: sith/settings.py:569
msgid "You successfully sent the Weekmail" msgid "You successfully sent the Weekmail"
msgstr "Weekmail envoyé avec succès" msgstr "Weekmail envoyé avec succès"