Upgrade django2.2

This commit is contained in:
Evarin 2021-01-17 12:14:11 +01:00
parent 18d1d53c45
commit 72f28d185c
7 changed files with 86 additions and 37 deletions

File diff suppressed because one or more lines are too long

View file

@ -30,7 +30,8 @@ import ldap
#
class Normalien(models.Model):
user = models.OneToOneField(User, related_name="profil")
user = models.OneToOneField(User, related_name="profil",
on_delete=models.SET_NULL, null=True)
# Infos spécifiques
nom = models.CharField(u"Nom complet", max_length=255, blank=True)
@ -121,7 +122,7 @@ class Lieu(models.Model):
max_length=choices_length(PAYS_OPTIONS))
# Coordonnées
objects = geomodels.GeoManager() # Requis par GeoDjango
#objects = geomodels.GeoManager() # Requis par GeoDjango
coord = geomodels.PointField(u"Coordonnées",
geography=True,
srid = 4326)
@ -163,7 +164,8 @@ class StageMatiere(models.Model):
class Stage(models.Model):
# Misc
auteur = models.ForeignKey(Normalien, related_name="stages")
auteur = models.ForeignKey(Normalien, related_name="stages",
on_delete=models.SET_NULL, null=True)
public = models.BooleanField(u"Visible publiquement", default=False)
date_creation = models.DateTimeField(u"Créé le", default=timezone.now)
date_maj = models.DateTimeField(u"Mis à jour le", default=timezone.now)
@ -260,7 +262,8 @@ class Stage(models.Model):
#
class AvisStage(models.Model):
stage = models.OneToOneField(Stage, related_name="avis_stage")
stage = models.OneToOneField(Stage, related_name="avis_stage",
on_delete=models.CASCADE)
chapo = models.TextField(u"En quelques mots", blank=True)
avis_ambiance = RichTextField(u"L'ambiance de travail", blank=True)
@ -283,8 +286,8 @@ class AvisStage(models.Model):
class AvisLieu(models.Model):
stage = models.ForeignKey(Stage)
lieu = models.ForeignKey(Lieu)
stage = models.ForeignKey(Stage, on_delete=models.CASCADE)
lieu = models.ForeignKey(Lieu, on_delete=models.CASCADE)
order = models.IntegerField("Ordre", default=0)
chapo = models.TextField(u"En quelques mots", blank=True)

View file

@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.urls import include, path
from . import views, api
from tastypie.api import Api
@ -7,27 +7,28 @@ v1_api.register(api.LieuResource())
v1_api.register(api.StageResource())
v1_api.register(api.AuteurResource())
app_name = "avisstage"
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^perso/$', views.perso, name='perso'),
url(r'^faq/$', views.faq, name='faq'),
url(r'^stage/nouveau/$', views.manage_stage, name='stage_ajout'),
url(r'^stage/(?P<pk>\w+)/$', views.StageView.as_view(), name='stage'),
url(r'^stage/(?P<pk>\w+)/edit/$', views.manage_stage, name='stage_edit'),
url(r'^stage/(?P<pk>\w+)/publication/$', views.publier_stage,
path('', views.index, name='index'),
path('perso/', views.perso, name='perso'),
path('faq/', views.faq, name='faq'),
path('stage/nouveau/', views.manage_stage, name='stage_ajout'),
path('stage/<int:pk>/', views.StageView.as_view(), name='stage'),
path('stage/<int:pk>/edit/', views.manage_stage, name='stage_edit'),
path('stage/<int:pk>/publication/', views.publier_stage,
name='stage_publication'),
url(r'^403/archicubes/$', views.archicubes_interdits,
path('403/archicubes/', views.archicubes_interdits,
name='403-archicubes'),
url(r'^lieu/save/$', views.save_lieu, name='lieu_ajout'),
url(r'^profil/show/(?P<username>[\w@]+)/$', views.ProfilView.as_view(),
path('lieu/save/', views.save_lieu, name='lieu_ajout'),
path('profil/show/<str:username>/', views.ProfilView.as_view(),
name='profil'),
url(r'^profil/edit/$', views.ProfilEdit.as_view(), name='profil_edit'),
url(r'^recherche/$', views.recherche, name='recherche'),
url(r'^recherche/resultats/$', views.recherche_resultats,
path('profil/edit/', views.ProfilEdit.as_view(), name='profil_edit'),
path('recherche/', views.recherche, name='recherche'),
path('recherche/resultats/', views.recherche_resultats,
name='recherche_resultats'),
url(r'^recherche/items/$', views.stage_items, name='stage_items'),
url(r'^feedback/$', views.feedback, name='feedback'),
url(r'^moderation/$', views.statistiques, name='moderation'),
url(r'^api/', include(v1_api.urls)),
path('recherche/items/', views.stage_items, name='stage_items'),
path('feedback/', views.feedback, name='feedback'),
path('moderation/', views.statistiques, name='moderation'),
path('api/', include(v1_api.urls)),
]

View file

@ -10,7 +10,7 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.core.urlresolvers import reverse_lazy
from django.urls import reverse_lazy
from .secrets import SECRET_KEY, GOOGLE_API_KEY, MAPBOX_API_KEY
@ -53,12 +53,12 @@ INSTALLED_APPS = [
'avisstage'
]
MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

View file

@ -9,7 +9,7 @@ DATABASES = {
}
}
USE_DEBUG_TOOLBAR = True
USE_DEBUG_TOOLBAR = False
if USE_DEBUG_TOOLBAR:
INSTALLED_APPS += [
@ -22,7 +22,7 @@ if USE_DEBUG_TOOLBAR:
INTERNAL_IPS = ['127.0.0.1']
SPATIALITE_LIBRARY_PATH = 'mod_spatialite'
SPATIALITE_LIBRARY_PATH = 'mod_spatialite.so'
STATIC_ROOT = "/home/evarin/Bureau/experiENS/static/"

View file

@ -1,19 +1,19 @@
from django.conf import settings
from django.conf.urls import include, url
from django.urls import include, path
from django.contrib import admin
urlpatterns = [
url(r'^', include('avisstage.urls', namespace='avisstage')),
path('', include('avisstage.urls')),
url(r'^account/', include('allauth_ens.urls')),
path('account/', include('allauth_ens.urls')),
url(r'^tinymce/', include('tinymce.urls')),
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
url(r'^admin/', include(admin.site.urls)),
path('tinymce/', include('tinymce.urls')),
path('taggit_autosuggest/', include('taggit_autosuggest.urls')),
path('admin/', admin.site.urls),
]
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns

View file

@ -1,4 +1,4 @@
django==1.11.*
django==2.2.*
django-cas-ng==3.5.*
django-taggit==0.22.*
python-ldap==3.0.*