forked from DGNum/gestioCOF
Compare commits
8 commits
Production
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
69976a878a | ||
|
6621ae3950 | ||
|
9288daaf9e | ||
|
e92c500940 | ||
|
d75eaf583f | ||
|
55bd3ab51d | ||
|
f640a25f59 | ||
|
f881c7cd8b |
|
@ -206,7 +206,7 @@ MAIL_DATA = {
|
|||
"REPLYTO": "cof@ens.fr",
|
||||
},
|
||||
"rappels": {"FROM": "Le BdA <bda@ens.fr>", "REPLYTO": "Le BdA <bda@ens.fr>"},
|
||||
"rappel_negatif": {
|
||||
"kfet": {
|
||||
"FROM": "La K-Fêt <chefs-k-fet@ens.fr>",
|
||||
"REPLYTO": "La K-Fêt <chefs-k-fet@ens.fr>",
|
||||
},
|
||||
|
|
|
@ -2,6 +2,7 @@ import re
|
|||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.sites.models import Site
|
||||
from django.core.mail import EmailMessage
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import models, transaction
|
||||
|
@ -269,6 +270,32 @@ class Account(models.Model):
|
|||
def __init__(self, trigramme):
|
||||
self.trigramme = trigramme
|
||||
|
||||
def send_creation_email(self):
|
||||
"""
|
||||
Envoie un mail à la création du trigramme.
|
||||
"""
|
||||
mail_data = settings.MAIL_DATA["kfet"]
|
||||
|
||||
email = EmailMessage(
|
||||
subject="Création d'un trigramme",
|
||||
body=loader.render_to_string(
|
||||
"kfet/mails/creation_trigramme.txt",
|
||||
context={
|
||||
"account": self,
|
||||
"site": Site.objects.get_current(),
|
||||
"url_read": reverse("kfet.account.read", args=(self.trigramme)),
|
||||
"url_update": reverse("kfet.account.update", args=(self.trigramme)),
|
||||
"url_delete": reverse("kfet.account.delete", args=(self.trigramme))
|
||||
},
|
||||
),
|
||||
from_email=mail_data["FROM"],
|
||||
to=[self.email],
|
||||
reply_to=[mail_data["REPLYTO"]],
|
||||
)
|
||||
|
||||
# On envoie le mail
|
||||
email.send()
|
||||
|
||||
|
||||
def get_deleted_account():
|
||||
return Account.objects.get(trigramme=KFET_DELETED_TRIGRAMME)
|
||||
|
@ -298,7 +325,7 @@ class AccountNegative(models.Model):
|
|||
"""
|
||||
Envoie un mail de rappel signalant que la personne est en négatif.
|
||||
"""
|
||||
mail_data = settings.MAIL_DATA["rappel_negatif"]
|
||||
mail_data = settings.MAIL_DATA["kfet"]
|
||||
|
||||
email = EmailMessage(
|
||||
subject="Compte K-Psul négatif",
|
||||
|
@ -321,7 +348,6 @@ class AccountNegative(models.Model):
|
|||
# On enregistre le fait que l'envoi a bien eu lieu
|
||||
self.last_rappel = timezone.now()
|
||||
self.save()
|
||||
return
|
||||
|
||||
|
||||
class CheckoutQuerySet(models.QuerySet):
|
||||
|
|
|
@ -78,7 +78,7 @@ class KfetWebsocket {
|
|||
|
||||
listen() {
|
||||
var that = this;
|
||||
this.socket = new ReconnectingWebSocket(this.url);
|
||||
this.socket = new ReconnectingWebSocket(this.url, [], { minReconnectionDelay: 100 });
|
||||
|
||||
this.socket.onmessage = function (e) {
|
||||
var data = $.extend({}, that.default_msg, JSON.parse(e.data));
|
||||
|
|
12
kfet/templates/kfet/mails/creation_trigramme.txt
Normal file
12
kfet/templates/kfet/mails/creation_trigramme.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
Salut {{ account.name }},
|
||||
|
||||
Ton compte K-Fêt a bien été créé le {{ account.created_at }} avec le trigramme {{ account.trigramme }}.
|
||||
|
||||
Tu peux désormais :
|
||||
- Accéder à ton historique personnel des consommations : https://{{ site }}{{ url_read }}
|
||||
- Modifier tes informations : https://{{ site }}{{ url_update }}
|
||||
- Supprimer ton compte : https://{{ site }}{{ url_delete }}
|
||||
|
||||
En espérant te revoir bientôt,
|
||||
--
|
||||
L'équipe K-Fêt
|
|
@ -243,6 +243,7 @@ def account_create(request):
|
|||
account_form = AccountNoTriForm(request.POST, instance=account)
|
||||
account_form.save()
|
||||
messages.success(request, "Compte créé : %s" % account.trigramme)
|
||||
account.send_creation_email()
|
||||
return redirect("kfet.account.create")
|
||||
except Account.UserHasAccount as e:
|
||||
messages.error(
|
||||
|
|
|
@ -10,14 +10,14 @@ Le COF a reçu une demande de petit cours qui te correspond. Tu es en haut de la
|
|||
|
||||
¤ Lieu (si préféré) : {{ demande.lieu }}
|
||||
|
||||
¤ Niveau : {{ demande.get_niveau_display }}
|
||||
|
||||
¤ Remarques diverses (désolé pour les balises HTML) : {{ demande.remarques }}
|
||||
|
||||
{% if matieres|length > 1 %}¤ Matières :
|
||||
{% for matiere in matieres %} ¤ {{ matiere }}
|
||||
{% endfor %}{% else %}¤ Matière : {% for matiere in matieres %}{{ matiere }}
|
||||
{% endfor %}{% endif %}
|
||||
¤ Niveau : {{ demande.get_niveau_display }}
|
||||
|
||||
¤ Remarques diverses (désolé pour les balises HTML) : {{ demande.remarques }}
|
||||
|
||||
Voilà, cette personne te contactera peut-être sous peu, tu pourras voir les détails directement avec elle (prix, modalités, ...). Pour indication, 30 Euro/h semble être la moyenne.
|
||||
|
||||
Si tu te rends compte qu'en fait tu ne peux pas/plus donner de cours en ce moment, ça serait cool que tu décoches la case "Recevoir des propositions de petits cours" sur GestioCOF. Ensuite dès que tu voudras réapparaître tu pourras recocher la case et tu seras à nouveau sur la liste.
|
||||
|
|
40
shell.nix
40
shell.nix
|
@ -1,29 +1,12 @@
|
|||
{ pkgs ? import <nixpkgs> { }, ... }:
|
||||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
python = pkgs.python38;
|
||||
|
||||
django-types = python.pkgs.buildPythonPackage rec {
|
||||
pname = "django-types";
|
||||
version = "0.17.0";
|
||||
|
||||
format = "pyproject";
|
||||
|
||||
src = pkgs.fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-wcQqt4h2xXxyg0LVqwYHJas3H8jcg7uFuuC+BoRqrXA=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = with python.pkgs; [ poetry-core ];
|
||||
|
||||
# setup.cfg tries to pull in nonexistent LICENSE.txt file
|
||||
# postPatch = "rm setup.cfg";
|
||||
|
||||
# propagatedBuildInputs = [ django typing-extensions ];
|
||||
};
|
||||
python = pkgs.python39;
|
||||
in
|
||||
|
||||
|
||||
pkgs.mkShell {
|
||||
shellHook = ''
|
||||
export DJANGO_SETTINGS_MODULE=gestioasso.settings.local
|
||||
|
@ -34,11 +17,14 @@ pkgs.mkShell {
|
|||
pip install -r requirements-devel.txt | grep -v 'Requirement already satisfied:'
|
||||
'';
|
||||
|
||||
packages = [ python django-types ] ++ (with python.pkgs; [
|
||||
pip
|
||||
virtualenv
|
||||
python-ldap
|
||||
]);
|
||||
packages =
|
||||
[ python ]
|
||||
++ (with python.pkgs; [
|
||||
django-types
|
||||
pip
|
||||
virtualenv
|
||||
python-ldap
|
||||
]);
|
||||
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue