mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Merge branch 'django-3.2' into 'master'
Upgrade to django 3.2 * Upgrade dependencies * Fix ugettext * Fix bad urls See merge request ae-utbm/Sith!316
This commit is contained in:
commit
0c2494cb34
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,7 +5,6 @@ db.sqlite3
|
|||||||
*__pycache__*
|
*__pycache__*
|
||||||
.DS_Store
|
.DS_Store
|
||||||
pyrightconfig.json
|
pyrightconfig.json
|
||||||
poetry.lock
|
|
||||||
dist/
|
dist/
|
||||||
.vscode/
|
.vscode/
|
||||||
env/
|
env/
|
||||||
|
@ -27,7 +27,7 @@ from django.core.exceptions import ValidationError
|
|||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.template import defaultfilters
|
from django.template import defaultfilters
|
||||||
|
|
||||||
from phonenumber_field.modelfields import PhoneNumberField
|
from phonenumber_field.modelfields import PhoneNumberField
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
from django.views.generic import ListView, DetailView
|
from django.views.generic import ListView, DetailView
|
||||||
from django.views.generic.edit import UpdateView, CreateView, DeleteView, FormView
|
from django.views.generic.edit import UpdateView, CreateView, DeleteView, FormView
|
||||||
from django.urls import reverse_lazy, reverse
|
from django.urls import reverse_lazy, reverse
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.forms.models import modelform_factory
|
from django.forms.models import modelform_factory
|
||||||
from django.core.exceptions import PermissionDenied, ValidationError
|
from django.core.exceptions import PermissionDenied, ValidationError
|
||||||
from django.forms import HiddenInput
|
from django.forms import HiddenInput
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from ajax_select.fields import AutoCompleteSelectField, AutoCompleteSelectMultipleField
|
from ajax_select.fields import AutoCompleteSelectField, AutoCompleteSelectMultipleField
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.core.exceptions import ValidationError, ObjectDoesNotExist
|
from django.core.exceptions import ValidationError, ObjectDoesNotExist
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for widget in form_mailing_removal.subwidgets %}
|
{% for widget in form_mailing_removal.subwidgets %}
|
||||||
{% set user = ms[widget.data.value][0] %}
|
{% set user = ms[widget.data.value.value][0] %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ user.get_username }}</td>
|
<td>{{ user.get_username }}</td>
|
||||||
<td>{{ user.get_email }}</td>
|
<td>{{ user.get_email }}</td>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import timezone, html
|
from django.utils import timezone, html
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
|
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
|
||||||
@ -180,7 +180,7 @@ class ClubTest(TestCase):
|
|||||||
)
|
)
|
||||||
self.assertTrue(response.status_code == 200)
|
self.assertTrue(response.status_code == 200)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
"<li>Vous n'avez pas la permission de faire cela</li>"
|
"<li>Vous n'avez pas la permission de faire cela</li>"
|
||||||
in str(response.content)
|
in str(response.content)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ from django.http import (
|
|||||||
)
|
)
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils.translation import ugettext as _t
|
from django.utils.translation import gettext as _t
|
||||||
from django.core.exceptions import PermissionDenied, ValidationError, NON_FIELD_ERRORS
|
from django.core.exceptions import PermissionDenied, ValidationError, NON_FIELD_ERRORS
|
||||||
from django.core.paginator import Paginator, InvalidPage
|
from django.core.paginator import Paginator, InvalidPage
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
|
@ -26,11 +26,11 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.staticfiles.templatetags.staticfiles import static
|
from django.templatetags.static import static
|
||||||
from django.core.mail import EmailMultiAlternatives
|
from django.core.mail import EmailMultiAlternatives
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
|
10
com/tests.py
10
com/tests.py
@ -27,7 +27,7 @@ from django.conf import settings
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.utils import html
|
from django.utils import html
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
|
||||||
from core.models import User, RealGroup
|
from core.models import User, RealGroup
|
||||||
@ -40,8 +40,8 @@ class ComAlertTest(TestCase):
|
|||||||
def test_page_is_working(self):
|
def test_page_is_working(self):
|
||||||
self.client.login(username="comunity", password="plop")
|
self.client.login(username="comunity", password="plop")
|
||||||
response = self.client.get(reverse("com:alert_edit"))
|
response = self.client.get(reverse("com:alert_edit"))
|
||||||
self.assertNotEquals(response.status_code, 500)
|
self.assertNotEqual(response.status_code, 500)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
class ComInfoTest(TestCase):
|
class ComInfoTest(TestCase):
|
||||||
@ -51,8 +51,8 @@ class ComInfoTest(TestCase):
|
|||||||
def test_page_is_working(self):
|
def test_page_is_working(self):
|
||||||
self.client.login(username="comunity", password="plop")
|
self.client.login(username="comunity", password="plop")
|
||||||
response = self.client.get(reverse("com:info_edit"))
|
response = self.client.get(reverse("com:info_edit"))
|
||||||
self.assertNotEquals(response.status_code, 500)
|
self.assertNotEqual(response.status_code, 500)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
class ComTest(TestCase):
|
class ComTest(TestCase):
|
||||||
|
@ -28,7 +28,7 @@ from django.http import HttpResponseRedirect
|
|||||||
from django.views.generic import ListView, DetailView, View
|
from django.views.generic import ListView, DetailView, View
|
||||||
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
||||||
from django.views.generic.detail import SingleObjectMixin
|
from django.views.generic.detail import SingleObjectMixin
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
@ -21,5 +21,3 @@
|
|||||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
default_app_config = "core.apps.SithConfig"
|
|
||||||
|
@ -34,7 +34,7 @@ from django.contrib.auth.models import (
|
|||||||
GroupManager as AuthGroupManager,
|
GroupManager as AuthGroupManager,
|
||||||
AnonymousUser as AuthAnonymousUser,
|
AnonymousUser as AuthAnonymousUser,
|
||||||
)
|
)
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.core.exceptions import ValidationError, PermissionDenied
|
from django.core.exceptions import ValidationError, PermissionDenied
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sass
|
import sass
|
||||||
|
from urllib.parse import urljoin
|
||||||
from django.utils.encoding import force_bytes, iri_to_uri
|
from django.utils.encoding import force_bytes, iri_to_uri
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
from django.utils.six.moves.urllib.parse import urljoin
|
|
||||||
from django.templatetags.static import static
|
from django.templatetags.static import static
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from core.scss.storage import ScssFileStorage, find_file
|
from core.scss.storage import ScssFileStorage, find_file
|
||||||
|
@ -402,32 +402,32 @@ class UserToolsTest(TestCase):
|
|||||||
|
|
||||||
def test_anonymous_user_unauthorized(self):
|
def test_anonymous_user_unauthorized(self):
|
||||||
response = self.client.get(reverse("core:user_tools"))
|
response = self.client.get(reverse("core:user_tools"))
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
def test_page_is_working(self):
|
def test_page_is_working(self):
|
||||||
# Test for simple user
|
# Test for simple user
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
response = self.client.get(reverse("core:user_tools"))
|
response = self.client.get(reverse("core:user_tools"))
|
||||||
self.assertNotEquals(response.status_code, 500)
|
self.assertNotEqual(response.status_code, 500)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Test for root
|
# Test for root
|
||||||
self.client.login(username="root", password="plop")
|
self.client.login(username="root", password="plop")
|
||||||
response = self.client.get(reverse("core:user_tools"))
|
response = self.client.get(reverse("core:user_tools"))
|
||||||
self.assertNotEquals(response.status_code, 500)
|
self.assertNotEqual(response.status_code, 500)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Test for skia
|
# Test for skia
|
||||||
self.client.login(username="skia", password="plop")
|
self.client.login(username="skia", password="plop")
|
||||||
response = self.client.get(reverse("core:user_tools"))
|
response = self.client.get(reverse("core:user_tools"))
|
||||||
self.assertNotEquals(response.status_code, 500)
|
self.assertNotEqual(response.status_code, 500)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Test for comunity
|
# Test for comunity
|
||||||
self.client.login(username="comunity", password="plop")
|
self.client.login(username="comunity", password="plop")
|
||||||
response = self.client.get(reverse("core:user_tools"))
|
response = self.client.get(reverse("core:user_tools"))
|
||||||
self.assertNotEquals(response.status_code, 500)
|
self.assertNotEqual(response.status_code, 500)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
# TODO: many tests on the pages:
|
# TODO: many tests on the pages:
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
from django.urls import re_path
|
from django.urls import re_path, path
|
||||||
|
|
||||||
from core.views import *
|
from core.views import *
|
||||||
|
|
||||||
@ -60,8 +60,8 @@ urlpatterns = [
|
|||||||
SithPasswordResetDoneView.as_view(),
|
SithPasswordResetDoneView.as_view(),
|
||||||
name="password_reset_done",
|
name="password_reset_done",
|
||||||
),
|
),
|
||||||
re_path(
|
path(
|
||||||
r"^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$",
|
r"reset/<str:uidb64>/<str:token>/",
|
||||||
SithPasswordResetConfirmView.as_view(),
|
SithPasswordResetConfirmView.as_view(),
|
||||||
name="password_reset_confirm",
|
name="password_reset_confirm",
|
||||||
),
|
),
|
||||||
|
@ -29,7 +29,7 @@ from django.views.generic.edit import UpdateView, FormMixin, DeleteView
|
|||||||
from django.views.generic.detail import SingleObjectMixin
|
from django.views.generic.detail import SingleObjectMixin
|
||||||
from django.forms.models import modelform_factory
|
from django.forms.models import modelform_factory
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from wsgiref.util import FileWrapper
|
from wsgiref.util import FileWrapper
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
@ -147,7 +147,7 @@ class FileListView(ListView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs = super(FileListView, self).get_context_data(**kwargs)
|
kwargs = super(FileListView, self).get_context_data(**kwargs)
|
||||||
kwargs["popup"] = ""
|
kwargs["popup"] = ""
|
||||||
if self.kwargs["popup"]:
|
if self.kwargs.get("popup") is not None:
|
||||||
kwargs["popup"] = "popup"
|
kwargs["popup"] = "popup"
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ class FileEditView(CanEditMixin, UpdateView):
|
|||||||
return modelform_factory(SithFile, fields=fields)
|
return modelform_factory(SithFile, fields=fields)
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
if self.kwargs["popup"]:
|
if self.kwargs.get("popup") is not None:
|
||||||
return reverse(
|
return reverse(
|
||||||
"core:file_detail", kwargs={"file_id": self.object.id, "popup": "popup"}
|
"core:file_detail", kwargs={"file_id": self.object.id, "popup": "popup"}
|
||||||
)
|
)
|
||||||
@ -176,7 +176,7 @@ class FileEditView(CanEditMixin, UpdateView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs = super(FileEditView, self).get_context_data(**kwargs)
|
kwargs = super(FileEditView, self).get_context_data(**kwargs)
|
||||||
kwargs["popup"] = ""
|
kwargs["popup"] = ""
|
||||||
if self.kwargs["popup"]:
|
if self.kwargs.get("popup") is not None:
|
||||||
kwargs["popup"] = "popup"
|
kwargs["popup"] = "popup"
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
@ -217,13 +217,13 @@ class FileEditPropView(CanEditPropMixin, UpdateView):
|
|||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
return reverse(
|
return reverse(
|
||||||
"core:file_detail",
|
"core:file_detail",
|
||||||
kwargs={"file_id": self.object.id, "popup": self.kwargs["popup"] or ""},
|
kwargs={"file_id": self.object.id, "popup": self.kwargs.get("popup", "")},
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs = super(FileEditPropView, self).get_context_data(**kwargs)
|
kwargs = super(FileEditPropView, self).get_context_data(**kwargs)
|
||||||
kwargs["popup"] = ""
|
kwargs["popup"] = ""
|
||||||
if self.kwargs["popup"]:
|
if self.kwargs.get("popup") is not None:
|
||||||
kwargs["popup"] = "popup"
|
kwargs["popup"] = "popup"
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
@ -301,14 +301,14 @@ class FileView(CanViewMixin, DetailView, FormMixin):
|
|||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
return reverse(
|
return reverse(
|
||||||
"core:file_detail",
|
"core:file_detail",
|
||||||
kwargs={"file_id": self.object.id, "popup": self.kwargs["popup"] or ""},
|
kwargs={"file_id": self.object.id, "popup": self.kwargs.get("popup", "")},
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs = super(FileView, self).get_context_data(**kwargs)
|
kwargs = super(FileView, self).get_context_data(**kwargs)
|
||||||
kwargs["popup"] = ""
|
kwargs["popup"] = ""
|
||||||
kwargs["form"] = self.form
|
kwargs["form"] = self.form
|
||||||
if self.kwargs["popup"]:
|
if self.kwargs.get("popup") is not None:
|
||||||
kwargs["popup"] = "popup"
|
kwargs["popup"] = "popup"
|
||||||
kwargs["clipboard"] = SithFile.objects.filter(
|
kwargs["clipboard"] = SithFile.objects.filter(
|
||||||
id__in=self.request.session["clipboard"]
|
id__in=self.request.session["clipboard"]
|
||||||
@ -328,20 +328,20 @@ class FileDeleteView(CanEditPropMixin, DeleteView):
|
|||||||
return self.request.GET["next"]
|
return self.request.GET["next"]
|
||||||
if self.object.parent is None:
|
if self.object.parent is None:
|
||||||
return reverse(
|
return reverse(
|
||||||
"core:file_list", kwargs={"popup": self.kwargs["popup"] or ""}
|
"core:file_list", kwargs={"popup": self.kwargs.get("popup", "")}
|
||||||
)
|
)
|
||||||
return reverse(
|
return reverse(
|
||||||
"core:file_detail",
|
"core:file_detail",
|
||||||
kwargs={
|
kwargs={
|
||||||
"file_id": self.object.parent.id,
|
"file_id": self.object.parent.id,
|
||||||
"popup": self.kwargs["popup"] or "",
|
"popup": self.kwargs.get("popup", ""),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs = super(FileDeleteView, self).get_context_data(**kwargs)
|
kwargs = super(FileDeleteView, self).get_context_data(**kwargs)
|
||||||
kwargs["popup"] = ""
|
kwargs["popup"] = ""
|
||||||
if self.kwargs["popup"]:
|
if self.kwargs.get("popup") is not None:
|
||||||
kwargs["popup"] = "popup"
|
kwargs["popup"] = "popup"
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ from django.forms import (
|
|||||||
DateTimeInput,
|
DateTimeInput,
|
||||||
Textarea,
|
Textarea,
|
||||||
)
|
)
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils.translation import ugettext
|
from django.utils.translation import gettext
|
||||||
from phonenumber_field.widgets import PhoneNumberInternationalFallbackWidget
|
from phonenumber_field.widgets import PhoneNumberInternationalFallbackWidget
|
||||||
from ajax_select.fields import AutoCompleteSelectField
|
from ajax_select.fields import AutoCompleteSelectField
|
||||||
from ajax_select import make_ajax_field
|
from ajax_select import make_ajax_field
|
||||||
@ -130,7 +130,7 @@ class SelectFile(TextInput):
|
|||||||
'<span name="'
|
'<span name="'
|
||||||
+ name
|
+ name
|
||||||
+ '" class="choose_file_button">'
|
+ '" class="choose_file_button">'
|
||||||
+ ugettext("Choose file")
|
+ gettext("Choose file")
|
||||||
+ "</span>"
|
+ "</span>"
|
||||||
)
|
)
|
||||||
return output
|
return output
|
||||||
@ -154,7 +154,7 @@ class SelectUser(TextInput):
|
|||||||
'<span name="'
|
'<span name="'
|
||||||
+ name
|
+ name
|
||||||
+ '" class="choose_user_button">'
|
+ '" class="choose_user_button">'
|
||||||
+ ugettext("Choose user")
|
+ gettext("Choose user")
|
||||||
+ "</span>"
|
+ "</span>"
|
||||||
)
|
)
|
||||||
return output
|
return output
|
||||||
|
@ -31,7 +31,7 @@ from django.views.generic import ListView
|
|||||||
from django.views.generic.edit import FormView
|
from django.views.generic.edit import FormView
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from ajax_select.fields import AutoCompleteSelectMultipleField
|
from ajax_select.fields import AutoCompleteSelectMultipleField
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
from django.contrib.auth import views
|
from django.contrib.auth import views
|
||||||
from django.contrib.auth.forms import PasswordChangeForm
|
from django.contrib.auth.forms import PasswordChangeForm
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.core.exceptions import PermissionDenied, ValidationError
|
from django.core.exceptions import PermissionDenied, ValidationError
|
||||||
from django.http import Http404, HttpResponse
|
from django.http import Http404, HttpResponse
|
||||||
|
@ -22,5 +22,3 @@
|
|||||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
default_app_config = "counter.app.CounterConfig"
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
class CounterConfig(AppConfig):
|
class CounterConfig(AppConfig):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
from sith.settings import SITH_COUNTER_OFFICES, SITH_MAIN_CLUB
|
from sith.settings import SITH_COUNTER_OFFICES, SITH_MAIN_CLUB
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -110,6 +110,7 @@ class CounterTest(TestCase):
|
|||||||
"bank": "OTHER",
|
"bank": "OTHER",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
self.assertTrue(response.status_code == 200)
|
||||||
|
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("counter:login", kwargs={"counter_id": self.foyer.id}),
|
reverse("counter:login", kwargs={"counter_id": self.foyer.id}),
|
||||||
@ -139,7 +140,7 @@ class CounterTest(TestCase):
|
|||||||
"bank": "OTHER",
|
"bank": "OTHER",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.assertTrue(response.status_code == 403)
|
self.assertTrue(response.status_code == 200)
|
||||||
|
|
||||||
|
|
||||||
class CounterStatsTest(TestCase):
|
class CounterStatsTest(TestCase):
|
||||||
|
@ -41,7 +41,7 @@ from django.urls import reverse_lazy, reverse
|
|||||||
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
|
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import DataError, transaction, models
|
from django.db import DataError, transaction, models
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Pour modifier les cotisations disponnibles, tout se gère dans la configuration
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
SITH_SUBSCRIPTIONS = {
|
SITH_SUBSCRIPTIONS = {
|
||||||
# Voici un échantillon de la véritable configuration à l'heure de l'écriture.
|
# Voici un échantillon de la véritable configuration à l'heure de l'écriture.
|
||||||
|
@ -20,7 +20,7 @@ Nous allons présenter ici les deux techniques. Dans un premier temps nous allon
|
|||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from core.views import *
|
from core.views import *
|
||||||
from core.models import User, Group
|
from core.models import User, Group
|
||||||
@ -63,7 +63,7 @@ Voici maintenant comment faire en définissant des fonctions personnalisées. Ce
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from core.views import *
|
from core.views import *
|
||||||
from core.models import User, Group
|
from core.models import User, Group
|
||||||
|
@ -14,7 +14,7 @@ Si le mot est dans le code Python :
|
|||||||
|
|
||||||
.. sourcecode:: python
|
.. sourcecode:: python
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.db import models, DataError
|
from django.db import models, DataError
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class EbouticTest(TestCase):
|
|||||||
with open("./eboutic/tests/public_key.pem") as f:
|
with open("./eboutic/tests/public_key.pem") as f:
|
||||||
settings.SITH_EBOUTIC_PUB_KEY = f.read()
|
settings.SITH_EBOUTIC_PUB_KEY = f.read()
|
||||||
privkey = crypto.load_privatekey(crypto.FILETYPE_PEM, PRIVKEY)
|
privkey = crypto.load_privatekey(crypto.FILETYPE_PEM, PRIVKEY)
|
||||||
sig = crypto.sign(privkey, query, "sha1")
|
sig = crypto.sign(privkey, query.encode("utf-8"), "sha1")
|
||||||
b64sig = base64.b64encode(sig).decode("ascii")
|
b64sig = base64.b64encode(sig).decode("ascii")
|
||||||
|
|
||||||
url = reverse("eboutic:etransation_autoanswer") + "?%s&Sig=%s" % (
|
url = reverse("eboutic:etransation_autoanswer") + "?%s&Sig=%s" % (
|
||||||
|
@ -14,11 +14,11 @@ with open("./private_key.pem") as f:
|
|||||||
with open("./public_key.pem") as f:
|
with open("./public_key.pem") as f:
|
||||||
PUBKEY = f.read()
|
PUBKEY = f.read()
|
||||||
|
|
||||||
string = "Amount=400&BasketID=4000&Auto=42&Error=00000\n"
|
data = "Amount=400&BasketID=4000&Auto=42&Error=00000\n".encode("utf-8")
|
||||||
|
|
||||||
# Sign
|
# Sign
|
||||||
prvkey = crypto.load_privatekey(crypto.FILETYPE_PEM, PRVKEY)
|
prvkey = crypto.load_privatekey(crypto.FILETYPE_PEM, PRVKEY)
|
||||||
sig = crypto.sign(prvkey, string, "sha1")
|
sig = crypto.sign(prvkey, data, "sha1")
|
||||||
b64sig = base64.b64encode(sig)
|
b64sig = base64.b64encode(sig)
|
||||||
print(b64sig)
|
print(b64sig)
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ cert = crypto.X509()
|
|||||||
cert.set_pubkey(pubkey)
|
cert.set_pubkey(pubkey)
|
||||||
sig = base64.b64decode(b64sig)
|
sig = base64.b64decode(b64sig)
|
||||||
try:
|
try:
|
||||||
crypto.verify(cert, sig, string, "sha1")
|
crypto.verify(cert, sig, data, "sha1")
|
||||||
print("Verify OK")
|
print("Verify OK")
|
||||||
except:
|
except:
|
||||||
print("Verify failed")
|
print("Verify failed")
|
||||||
|
@ -33,7 +33,7 @@ from django.views.generic import TemplateView, View
|
|||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.core.exceptions import SuspiciousOperation
|
from django.core.exceptions import SuspiciousOperation
|
||||||
from django.db import transaction, DataError
|
from django.db import transaction, DataError
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from counter.models import Customer, Counter, ProductType, Selling
|
from counter.models import Customer, Counter, ProductType, Selling
|
||||||
@ -264,7 +264,7 @@ class EtransactionAutoAnswer(View):
|
|||||||
crypto.verify(
|
crypto.verify(
|
||||||
cert,
|
cert,
|
||||||
sig,
|
sig,
|
||||||
"&".join(request.META["QUERY_STRING"].split("&")[:-1]),
|
"&".join(request.META["QUERY_STRING"].split("&")[:-1]).encode("utf-8"),
|
||||||
"sha1",
|
"sha1",
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from ordered_model.models import OrderedModel
|
from ordered_model.models import OrderedModel
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from core.models import User, Group
|
from core.models import User, Group
|
||||||
|
@ -3,7 +3,7 @@ from django.views.generic import ListView, DetailView
|
|||||||
from django.views.generic.edit import UpdateView, CreateView
|
from django.views.generic.edit import UpdateView, CreateView
|
||||||
from django.views.generic.edit import DeleteView, FormView
|
from django.views.generic.edit import DeleteView, FormView
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.forms import CheckboxSelectMultiple
|
from django.forms import CheckboxSelectMultiple
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
@ -27,7 +27,7 @@ from django.shortcuts import get_object_or_404
|
|||||||
from django.views.generic import ListView, DetailView, RedirectView
|
from django.views.generic import ListView, DetailView, RedirectView
|
||||||
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
||||||
from django.views.generic.detail import SingleObjectMixin
|
from django.views.generic.detail import SingleObjectMixin
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils import timezone, html
|
from django.utils import timezone, html
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.db import models, DataError
|
from django.db import models, DataError
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import pytz
|
|||||||
|
|
||||||
from django.views.generic import ListView, DetailView, TemplateView
|
from django.views.generic import ListView, DetailView, TemplateView
|
||||||
from django.views.generic.edit import UpdateView, CreateView, DeleteView, BaseFormView
|
from django.views.generic.edit import UpdateView, CreateView, DeleteView, BaseFormView
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.utils import dateparse, timezone
|
from django.utils import dateparse, timezone
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -26,7 +26,7 @@ from enum import Enum
|
|||||||
|
|
||||||
from django.views.generic import ListView, View
|
from django.views.generic import ListView, View
|
||||||
from django.views.generic.edit import FormView
|
from django.views.generic.edit import FormView
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic.detail import SingleObjectMixin
|
from django.views.generic.detail import SingleObjectMixin
|
||||||
from django.http.response import HttpResponseRedirect
|
from django.http.response import HttpResponseRedirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.forms.widgets import Widget
|
from django.forms.widgets import Widget
|
||||||
from django.templatetags.static import static
|
from django.templatetags.static import static
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% set queryset = form.accepted_reports.field.queryset %}
|
{% set queryset = form.accepted_reports.field.queryset %}
|
||||||
{% for widget in form.accepted_reports.subwidgets %}
|
{% for widget in form.accepted_reports.subwidgets %}
|
||||||
{% set report = queryset.get(id=widget.data.value) %}
|
{% set report = queryset.get(id=widget.data.value.value) %}
|
||||||
<form action="{{ url('pedagogy:moderation') }}" method="post" enctype="multipart/form-data">
|
<form action="{{ url('pedagogy:moderation') }}" method="post" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
|
|
||||||
from core.models import User, Notification
|
from core.models import User, Notification
|
||||||
@ -95,7 +95,7 @@ class UVCreation(TestCase):
|
|||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:uv_create"), create_uv_template(self.bibou.id)
|
reverse("pedagogy:uv_create"), create_uv_template(self.bibou.id)
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.assertTrue(UV.objects.filter(code="IFC1").exists())
|
self.assertTrue(UV.objects.filter(code="IFC1").exists())
|
||||||
|
|
||||||
def test_create_uv_pedagogy_admin_success(self):
|
def test_create_uv_pedagogy_admin_success(self):
|
||||||
@ -103,7 +103,7 @@ class UVCreation(TestCase):
|
|||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:uv_create"), create_uv_template(self.tutu.id)
|
reverse("pedagogy:uv_create"), create_uv_template(self.tutu.id)
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.assertTrue(UV.objects.filter(code="IFC1").exists())
|
self.assertTrue(UV.objects.filter(code="IFC1").exists())
|
||||||
|
|
||||||
def test_create_uv_unauthorized_fail(self):
|
def test_create_uv_unauthorized_fail(self):
|
||||||
@ -111,21 +111,21 @@ class UVCreation(TestCase):
|
|||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:uv_create"), create_uv_template(0)
|
reverse("pedagogy:uv_create"), create_uv_template(0)
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Test with subscribed user
|
# Test with subscribed user
|
||||||
self.client.login(username="sli", password="plop")
|
self.client.login(username="sli", password="plop")
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:uv_create"), create_uv_template(self.sli.id)
|
reverse("pedagogy:uv_create"), create_uv_template(self.sli.id)
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Test with non subscribed user
|
# Test with non subscribed user
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:uv_create"), create_uv_template(self.guy.id)
|
reverse("pedagogy:uv_create"), create_uv_template(self.guy.id)
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Check that the UV has never been created
|
# Check that the UV has never been created
|
||||||
self.assertFalse(UV.objects.filter(code="IFC1").exists())
|
self.assertFalse(UV.objects.filter(code="IFC1").exists())
|
||||||
@ -137,16 +137,16 @@ class UVCreation(TestCase):
|
|||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:uv_create"), create_uv_template(self.bibou.id)
|
reverse("pedagogy:uv_create"), create_uv_template(self.bibou.id)
|
||||||
)
|
)
|
||||||
self.assertNotEquals(response.status_code, 302)
|
self.assertNotEqual(response.status_code, 302)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Remove a required field
|
# Remove a required field
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:uv_create"),
|
reverse("pedagogy:uv_create"),
|
||||||
create_uv_template(self.tutu.id, exclude_list=["title"]),
|
create_uv_template(self.tutu.id, exclude_list=["title"]),
|
||||||
)
|
)
|
||||||
self.assertNotEquals(response.status_code, 302)
|
self.assertNotEqual(response.status_code, 302)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Check that the UV hase never been created
|
# Check that the UV hase never been created
|
||||||
self.assertFalse(UV.objects.filter(code="IFC1").exists())
|
self.assertFalse(UV.objects.filter(code="IFC1").exists())
|
||||||
@ -179,12 +179,12 @@ class UVListTest(TestCase):
|
|||||||
def test_uv_list_display_fail(self):
|
def test_uv_list_display_fail(self):
|
||||||
# Don't display for anonymous user
|
# Don't display for anonymous user
|
||||||
response = self.client.get(reverse("pedagogy:guide"))
|
response = self.client.get(reverse("pedagogy:guide"))
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Don't display for none subscribed users
|
# Don't display for none subscribed users
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:guide"))
|
response = self.client.get(reverse("pedagogy:guide"))
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
|
|
||||||
class UVDeleteTest(TestCase):
|
class UVDeleteTest(TestCase):
|
||||||
@ -220,7 +220,7 @@ class UVDeleteTest(TestCase):
|
|||||||
"pedagogy:uv_delete", kwargs={"uv_id": UV.objects.get(code="PA00").id}
|
"pedagogy:uv_delete", kwargs={"uv_id": UV.objects.get(code="PA00").id}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Not subscribed user
|
# Not subscribed user
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
@ -229,7 +229,7 @@ class UVDeleteTest(TestCase):
|
|||||||
"pedagogy:uv_delete", kwargs={"uv_id": UV.objects.get(code="PA00").id}
|
"pedagogy:uv_delete", kwargs={"uv_id": UV.objects.get(code="PA00").id}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Simply subscribed user
|
# Simply subscribed user
|
||||||
self.client.login(username="sli", password="plop")
|
self.client.login(username="sli", password="plop")
|
||||||
@ -238,7 +238,7 @@ class UVDeleteTest(TestCase):
|
|||||||
"pedagogy:uv_delete", kwargs={"uv_id": UV.objects.get(code="PA00").id}
|
"pedagogy:uv_delete", kwargs={"uv_id": UV.objects.get(code="PA00").id}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Check that the UV still exists
|
# Check that the UV still exists
|
||||||
self.assertTrue(UV.objects.filter(code="PA00").exists())
|
self.assertTrue(UV.objects.filter(code="PA00").exists())
|
||||||
@ -262,7 +262,7 @@ class UVUpdateTest(TestCase):
|
|||||||
create_uv_template(self.bibou.id, code="PA00"),
|
create_uv_template(self.bibou.id, code="PA00"),
|
||||||
)
|
)
|
||||||
self.uv.refresh_from_db()
|
self.uv.refresh_from_db()
|
||||||
self.assertEquals(self.uv.credit_type, "TM")
|
self.assertEqual(self.uv.credit_type, "TM")
|
||||||
|
|
||||||
def test_uv_update_pedagogy_admin_success(self):
|
def test_uv_update_pedagogy_admin_success(self):
|
||||||
self.client.login(username="tutu", password="plop")
|
self.client.login(username="tutu", password="plop")
|
||||||
@ -271,7 +271,7 @@ class UVUpdateTest(TestCase):
|
|||||||
create_uv_template(self.bibou.id, code="PA00"),
|
create_uv_template(self.bibou.id, code="PA00"),
|
||||||
)
|
)
|
||||||
self.uv.refresh_from_db()
|
self.uv.refresh_from_db()
|
||||||
self.assertEquals(self.uv.credit_type, "TM")
|
self.assertEqual(self.uv.credit_type, "TM")
|
||||||
|
|
||||||
def test_uv_update_original_author_does_not_change(self):
|
def test_uv_update_original_author_does_not_change(self):
|
||||||
self.client.login(username="tutu", password="plop")
|
self.client.login(username="tutu", password="plop")
|
||||||
@ -281,8 +281,8 @@ class UVUpdateTest(TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.uv.refresh_from_db()
|
self.uv.refresh_from_db()
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEquals(self.uv.author, self.bibou)
|
self.assertEqual(self.uv.author, self.bibou)
|
||||||
|
|
||||||
def test_uv_update_pedagogy_unauthorized_fail(self):
|
def test_uv_update_pedagogy_unauthorized_fail(self):
|
||||||
# Anonymous user
|
# Anonymous user
|
||||||
@ -290,7 +290,7 @@ class UVUpdateTest(TestCase):
|
|||||||
reverse("pedagogy:uv_update", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_update", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_template(self.bibou.id, code="PA00"),
|
create_uv_template(self.bibou.id, code="PA00"),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Not subscribed user
|
# Not subscribed user
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
@ -298,7 +298,7 @@ class UVUpdateTest(TestCase):
|
|||||||
reverse("pedagogy:uv_update", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_update", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_template(self.bibou.id, code="PA00"),
|
create_uv_template(self.bibou.id, code="PA00"),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Simply subscribed user
|
# Simply subscribed user
|
||||||
self.client.login(username="sli", password="plop")
|
self.client.login(username="sli", password="plop")
|
||||||
@ -306,11 +306,11 @@ class UVUpdateTest(TestCase):
|
|||||||
reverse("pedagogy:uv_update", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_update", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_template(self.bibou.id, code="PA00"),
|
create_uv_template(self.bibou.id, code="PA00"),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Check that the UV has not changed
|
# Check that the UV has not changed
|
||||||
self.uv.refresh_from_db()
|
self.uv.refresh_from_db()
|
||||||
self.assertEquals(self.uv.credit_type, "OM")
|
self.assertEqual(self.uv.credit_type, "OM")
|
||||||
|
|
||||||
|
|
||||||
# UVComment class tests
|
# UVComment class tests
|
||||||
@ -355,7 +355,7 @@ class UVCommentCreationAndDisplay(TestCase):
|
|||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_comment_template(self.bibou.id),
|
create_uv_comment_template(self.bibou.id),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id})
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id})
|
||||||
)
|
)
|
||||||
@ -367,7 +367,7 @@ class UVCommentCreationAndDisplay(TestCase):
|
|||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_comment_template(self.tutu.id),
|
create_uv_comment_template(self.tutu.id),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id})
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id})
|
||||||
)
|
)
|
||||||
@ -379,7 +379,7 @@ class UVCommentCreationAndDisplay(TestCase):
|
|||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_comment_template(self.sli.id),
|
create_uv_comment_template(self.sli.id),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id})
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id})
|
||||||
)
|
)
|
||||||
@ -391,7 +391,7 @@ class UVCommentCreationAndDisplay(TestCase):
|
|||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_comment_template(0),
|
create_uv_comment_template(0),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Test with non subscribed user
|
# Test with non subscribed user
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
@ -399,7 +399,7 @@ class UVCommentCreationAndDisplay(TestCase):
|
|||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_comment_template(self.guy.id),
|
create_uv_comment_template(self.guy.id),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Check that the comment has never been created
|
# Check that the comment has never been created
|
||||||
self.client.login(username="root", password="plop")
|
self.client.login(username="root", password="plop")
|
||||||
@ -415,7 +415,7 @@ class UVCommentCreationAndDisplay(TestCase):
|
|||||||
create_uv_comment_template(self.bibou.id, exclude_list=["grade_global"]),
|
create_uv_comment_template(self.bibou.id, exclude_list=["grade_global"]),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id})
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id})
|
||||||
@ -442,7 +442,7 @@ class UVCommentCreationAndDisplay(TestCase):
|
|||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}), comment
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}), comment
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
UVComment.objects.filter(comment__contains="Superbe UV").exists()
|
UVComment.objects.filter(comment__contains="Superbe UV").exists()
|
||||||
)
|
)
|
||||||
@ -459,12 +459,12 @@ class UVCommentCreationAndDisplay(TestCase):
|
|||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_comment_template(self.bibou.id, exclude_list=["uv"]),
|
create_uv_comment_template(self.bibou.id, exclude_list=["uv"]),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.client.post(
|
self.client.post(
|
||||||
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
|
||||||
create_uv_comment_template(self.bibou.id, exclude_list=["author"]),
|
create_uv_comment_template(self.bibou.id, exclude_list=["author"]),
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
class UVCommentDeleteTest(TestCase):
|
class UVCommentDeleteTest(TestCase):
|
||||||
@ -508,21 +508,21 @@ class UVCommentDeleteTest(TestCase):
|
|||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:comment_delete", kwargs={"comment_id": self.comment.id})
|
reverse("pedagogy:comment_delete", kwargs={"comment_id": self.comment.id})
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Unsbscribed user
|
# Unsbscribed user
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:comment_delete", kwargs={"comment_id": self.comment.id})
|
reverse("pedagogy:comment_delete", kwargs={"comment_id": self.comment.id})
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Subscribed user (not author of the comment)
|
# Subscribed user (not author of the comment)
|
||||||
self.client.login(username="sli", password="plop")
|
self.client.login(username="sli", password="plop")
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:comment_delete", kwargs={"comment_id": self.comment.id})
|
reverse("pedagogy:comment_delete", kwargs={"comment_id": self.comment.id})
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Check that the comment still exists
|
# Check that the comment still exists
|
||||||
self.assertTrue(UVComment.objects.filter(id=self.comment.id).exists())
|
self.assertTrue(UVComment.objects.filter(id=self.comment.id).exists())
|
||||||
@ -555,9 +555,9 @@ class UVCommentUpdateTest(TestCase):
|
|||||||
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
||||||
self.comment_edit,
|
self.comment_edit,
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.comment.refresh_from_db()
|
self.comment.refresh_from_db()
|
||||||
self.assertEquals(self.comment.comment, self.comment_edit["comment"])
|
self.assertEqual(self.comment.comment, self.comment_edit["comment"])
|
||||||
|
|
||||||
def test_uv_comment_update_pedagogy_admin_success(self):
|
def test_uv_comment_update_pedagogy_admin_success(self):
|
||||||
self.client.login(username="tutu", password="plop")
|
self.client.login(username="tutu", password="plop")
|
||||||
@ -565,9 +565,9 @@ class UVCommentUpdateTest(TestCase):
|
|||||||
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
||||||
self.comment_edit,
|
self.comment_edit,
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.comment.refresh_from_db()
|
self.comment.refresh_from_db()
|
||||||
self.assertEquals(self.comment.comment, self.comment_edit["comment"])
|
self.assertEqual(self.comment.comment, self.comment_edit["comment"])
|
||||||
|
|
||||||
def test_uv_comment_update_author_success(self):
|
def test_uv_comment_update_author_success(self):
|
||||||
self.client.login(username="krophil", password="plop")
|
self.client.login(username="krophil", password="plop")
|
||||||
@ -575,9 +575,9 @@ class UVCommentUpdateTest(TestCase):
|
|||||||
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
||||||
self.comment_edit,
|
self.comment_edit,
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.comment.refresh_from_db()
|
self.comment.refresh_from_db()
|
||||||
self.assertEquals(self.comment.comment, self.comment_edit["comment"])
|
self.assertEqual(self.comment.comment, self.comment_edit["comment"])
|
||||||
|
|
||||||
def test_uv_comment_update_unauthorized_fail(self):
|
def test_uv_comment_update_unauthorized_fail(self):
|
||||||
# Anonymous user
|
# Anonymous user
|
||||||
@ -585,25 +585,25 @@ class UVCommentUpdateTest(TestCase):
|
|||||||
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
||||||
self.comment_edit,
|
self.comment_edit,
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Unsbscribed user
|
# Unsbscribed user
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
||||||
self.comment_edit,
|
self.comment_edit,
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Subscribed user (not author of the comment)
|
# Subscribed user (not author of the comment)
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
||||||
self.comment_edit,
|
self.comment_edit,
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Check that the comment hasn't change
|
# Check that the comment hasn't change
|
||||||
self.comment.refresh_from_db()
|
self.comment.refresh_from_db()
|
||||||
self.assertNotEquals(self.comment.comment, self.comment_edit["comment"])
|
self.assertNotEqual(self.comment.comment, self.comment_edit["comment"])
|
||||||
|
|
||||||
def test_uv_comment_update_original_author_does_not_change(self):
|
def test_uv_comment_update_original_author_does_not_change(self):
|
||||||
self.client.login(username="root", password="plop")
|
self.client.login(username="root", password="plop")
|
||||||
@ -613,8 +613,8 @@ class UVCommentUpdateTest(TestCase):
|
|||||||
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
reverse("pedagogy:comment_update", kwargs={"comment_id": self.comment.id}),
|
||||||
self.comment_edit,
|
self.comment_edit,
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEquals(self.comment.author, self.krophil)
|
self.assertEqual(self.comment.author, self.krophil)
|
||||||
|
|
||||||
|
|
||||||
class UVSearchTest(TestCase):
|
class UVSearchTest(TestCase):
|
||||||
@ -631,27 +631,27 @@ class UVSearchTest(TestCase):
|
|||||||
# Test with root user
|
# Test with root user
|
||||||
self.client.login(username="root", password="plop")
|
self.client.login(username="root", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:guide"))
|
response = self.client.get(reverse("pedagogy:guide"))
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Test with pedagogy admin
|
# Test with pedagogy admin
|
||||||
self.client.login(username="tutu", password="plop")
|
self.client.login(username="tutu", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:guide"))
|
response = self.client.get(reverse("pedagogy:guide"))
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Test with subscribed user
|
# Test with subscribed user
|
||||||
self.client.login(username="sli", password="plop")
|
self.client.login(username="sli", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:guide"))
|
response = self.client.get(reverse("pedagogy:guide"))
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
def test_get_page_unauthorized_fail(self):
|
def test_get_page_unauthorized_fail(self):
|
||||||
# Test with anonymous user
|
# Test with anonymous user
|
||||||
response = self.client.get(reverse("pedagogy:guide"))
|
response = self.client.get(reverse("pedagogy:guide"))
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Test with not subscribed user
|
# Test with not subscribed user
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:guide"))
|
response = self.client.get(reverse("pedagogy:guide"))
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
def test_search_pa00_success(self):
|
def test_search_pa00_success(self):
|
||||||
self.client.login(username="sli", password="plop")
|
self.client.login(username="sli", password="plop")
|
||||||
@ -833,32 +833,32 @@ class UVModerationFormTest(TestCase):
|
|||||||
# Test with root
|
# Test with root
|
||||||
self.client.login(username="root", password="plop")
|
self.client.login(username="root", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:moderation"))
|
response = self.client.get(reverse("pedagogy:moderation"))
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Test with pedagogy admin
|
# Test with pedagogy admin
|
||||||
self.client.login(username="tutu", password="plop")
|
self.client.login(username="tutu", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:moderation"))
|
response = self.client.get(reverse("pedagogy:moderation"))
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
def test_access_unauthorized_fail(self):
|
def test_access_unauthorized_fail(self):
|
||||||
# Test with anonymous user
|
# Test with anonymous user
|
||||||
response = self.client.get(reverse("pedagogy:moderation"))
|
response = self.client.get(reverse("pedagogy:moderation"))
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Test with unsubscribed user
|
# Test with unsubscribed user
|
||||||
self.client.login(username="guy", password="plop")
|
self.client.login(username="guy", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:moderation"))
|
response = self.client.get(reverse("pedagogy:moderation"))
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
# Test with subscribed user
|
# Test with subscribed user
|
||||||
self.client.login(username="sli", password="plop")
|
self.client.login(username="sli", password="plop")
|
||||||
response = self.client.get(reverse("pedagogy:moderation"))
|
response = self.client.get(reverse("pedagogy:moderation"))
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
def test_do_nothing(self):
|
def test_do_nothing(self):
|
||||||
self.client.login(username="root", password="plop")
|
self.client.login(username="root", password="plop")
|
||||||
response = self.client.post(reverse("pedagogy:moderation"))
|
response = self.client.post(reverse("pedagogy:moderation"))
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
# Test that nothing has changed
|
# Test that nothing has changed
|
||||||
self.assertTrue(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
self.assertTrue(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
||||||
@ -874,7 +874,7 @@ class UVModerationFormTest(TestCase):
|
|||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:moderation"), {"accepted_reports": [self.report_1.id]}
|
reverse("pedagogy:moderation"), {"accepted_reports": [self.report_1.id]}
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
# Test that the comment and it's associated report has been deleted
|
# Test that the comment and it's associated report has been deleted
|
||||||
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
||||||
@ -894,7 +894,7 @@ class UVModerationFormTest(TestCase):
|
|||||||
reverse("pedagogy:moderation"),
|
reverse("pedagogy:moderation"),
|
||||||
{"accepted_reports": [self.report_1.id, self.report_2.id]},
|
{"accepted_reports": [self.report_1.id, self.report_2.id]},
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
# Test that comments and their associated reports has been deleted
|
# Test that comments and their associated reports has been deleted
|
||||||
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
||||||
@ -913,7 +913,7 @@ class UVModerationFormTest(TestCase):
|
|||||||
reverse("pedagogy:moderation"),
|
reverse("pedagogy:moderation"),
|
||||||
{"accepted_reports": [self.report_1.id, self.report_1_bis.id]},
|
{"accepted_reports": [self.report_1.id, self.report_1_bis.id]},
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
# Test that the comment and it's associated report has been deleted
|
# Test that the comment and it's associated report has been deleted
|
||||||
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
||||||
@ -928,7 +928,7 @@ class UVModerationFormTest(TestCase):
|
|||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse("pedagogy:moderation"), {"denied_reports": [self.report_1.id]}
|
reverse("pedagogy:moderation"), {"denied_reports": [self.report_1.id]}
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
# Test that the report has been deleted and that the comment still exists
|
# Test that the report has been deleted and that the comment still exists
|
||||||
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
||||||
@ -954,7 +954,7 @@ class UVModerationFormTest(TestCase):
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
# Test that every reports has been deleted
|
# Test that every reports has been deleted
|
||||||
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
self.assertFalse(UVCommentReport.objects.filter(id=self.report_1.id).exists())
|
||||||
@ -976,7 +976,7 @@ class UVModerationFormTest(TestCase):
|
|||||||
"denied_reports": [self.report_1.id],
|
"denied_reports": [self.report_1.id],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
# Test that report 2 and his comment has been deleted
|
# Test that report 2 and his comment has been deleted
|
||||||
self.assertFalse(UVCommentReport.objects.filter(id=self.report_2.id).exists())
|
self.assertFalse(UVCommentReport.objects.filter(id=self.report_2.id).exists())
|
||||||
@ -1000,7 +1000,7 @@ class UVModerationFormTest(TestCase):
|
|||||||
"denied_reports": [self.report_1_bis.id],
|
"denied_reports": [self.report_1_bis.id],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
# Test that report 1 and 1 bis has been deleted
|
# Test that report 1 and 1 bis has been deleted
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
@ -1047,10 +1047,10 @@ class UVCommentReportCreateTest(TestCase):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
if success:
|
if success:
|
||||||
self.assertEquals(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
else:
|
else:
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
self.assertEquals(UVCommentReport.objects.all().exists(), success)
|
self.assertEqual(UVCommentReport.objects.all().exists(), success)
|
||||||
|
|
||||||
def test_create_report_root_success(self):
|
def test_create_report_root_success(self):
|
||||||
self.create_report_test("root", True)
|
self.create_report_test("root", True)
|
||||||
@ -1069,7 +1069,7 @@ class UVCommentReportCreateTest(TestCase):
|
|||||||
reverse("pedagogy:comment_report", kwargs={"comment_id": self.comment.id}),
|
reverse("pedagogy:comment_report", kwargs={"comment_id": self.comment.id}),
|
||||||
{"comment": self.comment.id, "reporter": 0, "reason": "C'est moche"},
|
{"comment": self.comment.id, "reporter": 0, "reason": "C'est moche"},
|
||||||
)
|
)
|
||||||
self.assertEquals(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
self.assertFalse(UVCommentReport.objects.all().exists())
|
self.assertFalse(UVCommentReport.objects.all().exists())
|
||||||
|
|
||||||
def test_notifications(self):
|
def test_notifications(self):
|
||||||
@ -1092,7 +1092,7 @@ class UVCommentReportCreateTest(TestCase):
|
|||||||
|
|
||||||
# Check that notifications are not duplicated if not viewed
|
# Check that notifications are not duplicated if not viewed
|
||||||
self.create_report_test("tutu", True)
|
self.create_report_test("tutu", True)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
self.tutu.notifications.filter(type="PEDAGOGY_MODERATION").count(), 1
|
self.tutu.notifications.filter(type="PEDAGOGY_MODERATION").count(), 1
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1103,6 +1103,6 @@ class UVCommentReportCreateTest(TestCase):
|
|||||||
|
|
||||||
self.create_report_test("tutu", True)
|
self.create_report_test("tutu", True)
|
||||||
|
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
self.tutu.notifications.filter(type="PEDAGOGY_MODERATION").count(), 2
|
self.tutu.notifications.filter(type="PEDAGOGY_MODERATION").count(), 2
|
||||||
)
|
)
|
||||||
|
1271
poetry.lock
generated
Normal file
1271
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,29 +20,29 @@ license = "GPL-3.0-only"
|
|||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.8"
|
python = "^3.8"
|
||||||
Django = "^2.2"
|
Django = "^3.2"
|
||||||
Pillow = "^8.3.2"
|
Pillow = "^9.2"
|
||||||
mistune = "^0.8.4"
|
mistune = "^0.8.4"
|
||||||
django-jinja = "^2.9.1"
|
django-jinja = "^2.10"
|
||||||
cryptography = "36.0.2"
|
cryptography = "^37.0"
|
||||||
pyOpenSSL = "^21.0.0"
|
pyOpenSSL = "^21.0.0"
|
||||||
pytz = "^2021.1"
|
pytz = "^2021.1"
|
||||||
djangorestframework = "^3.12.4"
|
djangorestframework = "^3.13"
|
||||||
django-phonenumber-field = "^5.2.0"
|
django-phonenumber-field = "^6.3"
|
||||||
phonenumbers = "^8.12.33"
|
phonenumbers = "^8.12"
|
||||||
django-ajax-selects = "^2.1.0"
|
django-ajax-selects = "^2.1.0"
|
||||||
reportlab = "^3.6.1"
|
reportlab = "^3.6"
|
||||||
django-haystack = "^3.1.1"
|
django-haystack = "^3.2.1"
|
||||||
xapian-haystack = "^2.1.1"
|
xapian-haystack = "^3.0.1"
|
||||||
xapian-bindings = "^0.1.0"
|
xapian-bindings = "^0.1.0"
|
||||||
libsass = "^0.21.0"
|
libsass = "^0.21"
|
||||||
django-ordered-model = "^3.4.3"
|
django-ordered-model = "^3.6"
|
||||||
django-simple-captcha = "^0.5.14"
|
django-simple-captcha = "^0.5.17"
|
||||||
python-dateutil = "^2.8.2"
|
python-dateutil = "^2.8.2"
|
||||||
psycopg2-binary = "2.8.6"
|
psycopg2-binary = "2.9.3"
|
||||||
sentry-sdk = "^1.4.3"
|
sentry-sdk = "^1.4.3"
|
||||||
pygraphviz = "^1.9"
|
pygraphviz = "^1.9"
|
||||||
Jinja2 = "<=3.0.3"
|
Jinja2 = "^3.1"
|
||||||
|
|
||||||
# Extra optional dependencies
|
# Extra optional dependencies
|
||||||
mysqlclient = { version = "^2.0.3", optional = true }
|
mysqlclient = { version = "^2.0.3", optional = true }
|
||||||
@ -61,7 +61,7 @@ docs = ["Sphinx", "sphinx-rtd-theme", "sphinx-copybutton"]
|
|||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
django-debug-toolbar = "^3.2.2"
|
django-debug-toolbar = "^3.2.2"
|
||||||
ipython = "^7.28.0"
|
ipython = "^7.28.0"
|
||||||
black = "^22.3.0"
|
black = "^22.6.0"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.generic.edit import FormView
|
from django.views.generic.edit import FormView
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -26,7 +26,7 @@ from django.db import models
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -28,7 +28,7 @@ from django.urls import reverse_lazy, reverse
|
|||||||
from core.views.forms import SelectDate
|
from core.views.forms import SelectDate
|
||||||
from django.views.generic import DetailView, TemplateView
|
from django.views.generic import DetailView, TemplateView
|
||||||
from django.views.generic.edit import UpdateView, FormMixin, FormView
|
from django.views.generic.edit import UpdateView, FormMixin, FormView
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
|
@ -41,7 +41,7 @@ import sys
|
|||||||
import binascii
|
import binascii
|
||||||
import sentry_sdk
|
import sentry_sdk
|
||||||
from sentry_sdk.integrations.django import DjangoIntegration
|
from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
@ -62,6 +62,8 @@ ALLOWED_HOSTS = ["*"]
|
|||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
||||||
|
|
||||||
SITE_ID = 4000
|
SITE_ID = 4000
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
@ -132,9 +134,7 @@ TEMPLATES = [
|
|||||||
"extensions": [
|
"extensions": [
|
||||||
"jinja2.ext.do",
|
"jinja2.ext.do",
|
||||||
"jinja2.ext.loopcontrols",
|
"jinja2.ext.loopcontrols",
|
||||||
"jinja2.ext.with_",
|
|
||||||
"jinja2.ext.i18n",
|
"jinja2.ext.i18n",
|
||||||
"jinja2.ext.autoescape",
|
|
||||||
"django_jinja.builtins.extensions.CsrfExtension",
|
"django_jinja.builtins.extensions.CsrfExtension",
|
||||||
"django_jinja.builtins.extensions.CacheExtension",
|
"django_jinja.builtins.extensions.CacheExtension",
|
||||||
"django_jinja.builtins.extensions.TimezoneExtension",
|
"django_jinja.builtins.extensions.TimezoneExtension",
|
||||||
@ -389,7 +389,7 @@ SITH_SUBSCRIPTION_LOCATIONS = [
|
|||||||
|
|
||||||
SITH_COUNTER_BARS = [(1, "MDE"), (2, "Foyer"), (35, "La Gommette")]
|
SITH_COUNTER_BARS = [(1, "MDE"), (2, "Foyer"), (35, "La Gommette")]
|
||||||
|
|
||||||
SITH_COUNTER_OFFICES = {17: "BdF", 19: "AE"}
|
SITH_COUNTER_OFFICES = {2: "BdF", 1: "AE"}
|
||||||
|
|
||||||
SITH_COUNTER_PAYMENT_METHOD = [
|
SITH_COUNTER_PAYMENT_METHOD = [
|
||||||
("CHECK", _("Check")),
|
("CHECK", _("Check")),
|
||||||
|
62
sith/urls.py
62
sith/urls.py
@ -37,13 +37,15 @@ Including another URLconf
|
|||||||
1. Add an import: from blog import urls as blog_urls
|
1. Add an import: from blog import urls as blog_urls
|
||||||
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
|
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
|
||||||
"""
|
"""
|
||||||
from django.urls import include, re_path
|
from django.urls import include, path
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from django.views.i18n import JavaScriptCatalog
|
from django.views.i18n import JavaScriptCatalog
|
||||||
from ajax_select import urls as ajax_select_urls
|
from ajax_select import urls as ajax_select_urls
|
||||||
|
|
||||||
|
import core.urls
|
||||||
|
|
||||||
js_info_dict = {"packages": ("sith",)}
|
js_info_dict = {"packages": ("sith",)}
|
||||||
|
|
||||||
handler403 = "core.views.forbidden"
|
handler403 = "core.views.forbidden"
|
||||||
@ -51,43 +53,37 @@ handler404 = "core.views.not_found"
|
|||||||
handler500 = "core.views.internal_servor_error"
|
handler500 = "core.views.internal_servor_error"
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
re_path(r"^", include(("core.urls", "core"), namespace="core")),
|
path("", include(("core.urls", "core"), namespace="core")),
|
||||||
re_path(
|
path("rootplace/", include(("rootplace.urls", "rootplace"), namespace="rootplace")),
|
||||||
r"^rootplace/", include(("rootplace.urls", "rootplace"), namespace="rootplace")
|
path(
|
||||||
),
|
"subscription/",
|
||||||
re_path(
|
|
||||||
r"^subscription/",
|
|
||||||
include(("subscription.urls", "subscription"), namespace="subscription"),
|
include(("subscription.urls", "subscription"), namespace="subscription"),
|
||||||
),
|
),
|
||||||
re_path(r"^com/", include(("com.urls", "com"), namespace="com")),
|
path("com/", include(("com.urls", "com"), namespace="com")),
|
||||||
re_path(r"^club/", include(("club.urls", "club"), namespace="club")),
|
path("club/", include(("club.urls", "club"), namespace="club")),
|
||||||
re_path(r"^counter/", include(("counter.urls", "counter"), namespace="counter")),
|
path("counter/", include(("counter.urls", "counter"), namespace="counter")),
|
||||||
re_path(r"^stock/", include(("stock.urls", "stock"), namespace="stock")),
|
path("stock/", include(("stock.urls", "stock"), namespace="stock")),
|
||||||
re_path(
|
path(
|
||||||
r"^accounting/",
|
"accounting/",
|
||||||
include(("accounting.urls", "accounting"), namespace="accounting"),
|
include(("accounting.urls", "accounting"), namespace="accounting"),
|
||||||
),
|
),
|
||||||
re_path(r"^eboutic/", include(("eboutic.urls", "eboutic"), namespace="eboutic")),
|
path("eboutic/", include(("eboutic.urls", "eboutic"), namespace="eboutic")),
|
||||||
re_path(
|
path(
|
||||||
r"^launderette/",
|
"launderette/",
|
||||||
include(("launderette.urls", "launderette"), namespace="launderette"),
|
include(("launderette.urls", "launderette"), namespace="launderette"),
|
||||||
),
|
),
|
||||||
re_path(r"^sas/", include(("sas.urls", "sas"), namespace="sas")),
|
path("sas/", include(("sas.urls", "sas"), namespace="sas")),
|
||||||
re_path(r"^api/v1/", include(("api.urls", "api"), namespace="api")),
|
path("api/v1/", include(("api.urls", "api"), namespace="api")),
|
||||||
re_path(
|
path("election/", include(("election.urls", "election"), namespace="election")),
|
||||||
r"^election/", include(("election.urls", "election"), namespace="election")
|
path("forum/", include(("forum.urls", "forum"), namespace="forum")),
|
||||||
),
|
path("trombi/", include(("trombi.urls", "trombi"), namespace="trombi")),
|
||||||
re_path(r"^forum/", include(("forum.urls", "forum"), namespace="forum")),
|
path("matmatronch/", include(("matmat.urls", "matmat"), namespace="matmat")),
|
||||||
re_path(r"^trombi/", include(("trombi.urls", "trombi"), namespace="trombi")),
|
path("pedagogy/", include(("pedagogy.urls", "pedagogy"), namespace="pedagogy")),
|
||||||
re_path(r"^matmatronch/", include(("matmat.urls", "matmat"), namespace="matmat")),
|
path("admin/", admin.site.urls),
|
||||||
re_path(
|
path("ajax_select/", include(ajax_select_urls)),
|
||||||
r"^pedagogy/", include(("pedagogy.urls", "pedagogy"), namespace="pedagogy")
|
path("i18n/", include("django.conf.urls.i18n")),
|
||||||
),
|
path("jsi18n/", JavaScriptCatalog.as_view(), name="javascript-catalog"),
|
||||||
re_path(r"^admin/", admin.site.urls),
|
path("captcha/", include("captcha.urls")),
|
||||||
re_path(r"^ajax_select/", include(ajax_select_urls)),
|
|
||||||
re_path(r"^i18n/", include("django.conf.urls.i18n")),
|
|
||||||
re_path(r"^jsi18n/$", JavaScriptCatalog.as_view(), name="javascript-catalog"),
|
|
||||||
re_path(r"^captcha/", include("captcha.urls")),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
@ -95,4 +91,4 @@ if settings.DEBUG:
|
|||||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
import debug_toolbar
|
import debug_toolbar
|
||||||
|
|
||||||
urlpatterns += [re_path(r"^__debug__/", include(debug_toolbar.urls))]
|
urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ from django.views.generic.edit import (
|
|||||||
FormMixin,
|
FormMixin,
|
||||||
BaseFormView,
|
BaseFormView,
|
||||||
)
|
)
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.http import HttpResponseRedirect, HttpResponse
|
from django.http import HttpResponseRedirect, HttpResponse
|
||||||
from django.forms.models import modelform_factory
|
from django.forms.models import modelform_factory
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.views.generic.edit import CreateView, FormView
|
from django.views.generic.edit import CreateView, FormView
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.core.exceptions import PermissionDenied, ValidationError
|
from django.core.exceptions import PermissionDenied, ValidationError
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django import forms
|
from django import forms
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
@ -28,7 +28,7 @@ from django.shortcuts import get_object_or_404, redirect
|
|||||||
from django.urls import reverse_lazy, reverse
|
from django.urls import reverse_lazy, reverse
|
||||||
from django.views.generic import DetailView, RedirectView, TemplateView, View
|
from django.views.generic import DetailView, RedirectView, TemplateView, View
|
||||||
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.forms.models import modelform_factory
|
from django.forms.models import modelform_factory
|
||||||
|
Loading…
Reference in New Issue
Block a user