Commit 104571ed authored by Pagès Yannis's avatar Pagès Yannis
Browse files

add(sujet): sauvegarde de l'avancée effectuée

parent cf7ba4d6
......@@ -14,4 +14,4 @@ db.sqlite3*
*.autosave
*.swp
.DS_Store
scripts/
.vscode/
......@@ -13,6 +13,8 @@ django-hijack-admin = "*"
django-bootstrap-static = "*"
django-auth-ldap = "*"
pydotplus = "*"
django-pagedown = "*"
fontawesome = "*"
[dev-packages]
pytest = "*"
......
This diff is collapsed.
......@@ -32,6 +32,7 @@ INSTALLED_APPS = [
"hijack",
"hijack_admin",
"compat",
# "pagedown.apps.PagedownConfig",
]
MIDDLEWARE = [
......
from django import forms
from pagedown.widgets import PagedownWidget
from .models import Sujet
class SujetForm(forms.ModelForm):
description = forms.CharField(widget=PagedownWidget())
class Meta:
model = Sujet
fields = [
"nom",
"description",
"credits",
"nb_etudiants_min",
"nb_etudiants_max",
"semestres",
"evaluation",
"materiel",
]
......@@ -13,6 +13,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'projets/css/pao.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'projets/css/dataTables.fontAwesome.css' %}">
<script defer src="{% static 'fontawesome/js/fontawesome-all.min.js' %}"></script>
{% if form %} {{ form.media }} {% endif %}
</head>
<body>
......
......@@ -5,7 +5,7 @@
<tbody>
<tr>
<td width="15%">Description</td>
<td><pre>{{ sujet.description|wordwrap:170 }}</pre></td>
<td><pre>{{ sujet.description }}</pre></td>
</tr>
<tr>
<td>Nombre d'étudiants</td>
......
......@@ -12,6 +12,7 @@ from decimal import Decimal
from django.conf import settings
from django.contrib.auth.mixins import PermissionRequiredMixin
from .tools import ldaprequest
from .forms import SujetForm
# from django import forms
from .version import VERSION
......@@ -59,16 +60,7 @@ class MenuSujet(object):
class SujetCreate(MenuSujet, edit.CreateView):
model = Sujet
fields = [
"nom",
"description",
"credits",
"nb_etudiants_min",
"nb_etudiants_max",
"semestres",
"evaluation",
"materiel",
]
form_class = SujetForm
template_name = "projets/object_create.html"
def form_valid(self, form):
......@@ -101,16 +93,7 @@ class SujetList(MenuSujet, generic.ListView):
class SujetUpdate(MenuSujet, PermissionRequiredMixin, edit.UpdateView):
model = Sujet
fields = [
"nom",
"description",
"credits",
"nb_etudiants_min",
"nb_etudiants_max",
"semestres",
"evaluation",
"materiel",
]
form_class = SujetForm
template_name = "projets/sujet_update.html"
permission_required = "projets.add_pao"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment