Reformatage #29

Closed
thubrecht wants to merge 19 commits from thubrecht/python3 into master
7 changed files with 86 additions and 37 deletions
Showing only changes of commit 72f28d185c - Show all commits

File diff suppressed because one or more lines are too long

View file

@ -30,7 +30,8 @@ import ldap
# #
class Normalien(models.Model): 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 # Infos spécifiques
nom = models.CharField(u"Nom complet", max_length=255, blank=True) 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)) max_length=choices_length(PAYS_OPTIONS))
# Coordonnées # Coordonnées
objects = geomodels.GeoManager() # Requis par GeoDjango #objects = geomodels.GeoManager() # Requis par GeoDjango
coord = geomodels.PointField(u"Coordonnées", coord = geomodels.PointField(u"Coordonnées",
geography=True, geography=True,
srid = 4326) srid = 4326)
@ -163,7 +164,8 @@ class StageMatiere(models.Model):
class Stage(models.Model): class Stage(models.Model):
# Misc # 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) public = models.BooleanField(u"Visible publiquement", default=False)
date_creation = models.DateTimeField(u"Créé le", default=timezone.now) date_creation = models.DateTimeField(u"Créé le", default=timezone.now)
date_maj = models.DateTimeField(u"Mis à jour 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): 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) chapo = models.TextField(u"En quelques mots", blank=True)
avis_ambiance = RichTextField(u"L'ambiance de travail", blank=True) avis_ambiance = RichTextField(u"L'ambiance de travail", blank=True)
@ -283,8 +286,8 @@ class AvisStage(models.Model):
class AvisLieu(models.Model): class AvisLieu(models.Model):
stage = models.ForeignKey(Stage) stage = models.ForeignKey(Stage, on_delete=models.CASCADE)
lieu = models.ForeignKey(Lieu) lieu = models.ForeignKey(Lieu, on_delete=models.CASCADE)
order = models.IntegerField("Ordre", default=0) order = models.IntegerField("Ordre", default=0)
chapo = models.TextField(u"En quelques mots", blank=True) 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 . import views, api
from tastypie.api import Api from tastypie.api import Api
@ -7,27 +7,28 @@ v1_api.register(api.LieuResource())
v1_api.register(api.StageResource()) v1_api.register(api.StageResource())
v1_api.register(api.AuteurResource()) v1_api.register(api.AuteurResource())
app_name = "avisstage"
urlpatterns = [ urlpatterns = [
url(r'^$', views.index, name='index'), path('', views.index, name='index'),
url(r'^perso/$', views.perso, name='perso'), path('perso/', views.perso, name='perso'),
url(r'^faq/$', views.faq, name='faq'), path('faq/', views.faq, name='faq'),
url(r'^stage/nouveau/$', views.manage_stage, name='stage_ajout'), path('stage/nouveau/', views.manage_stage, name='stage_ajout'),
url(r'^stage/(?P<pk>\w+)/$', views.StageView.as_view(), name='stage'), path('stage/<int:pk>/', views.StageView.as_view(), name='stage'),
url(r'^stage/(?P<pk>\w+)/edit/$', views.manage_stage, name='stage_edit'), path('stage/<int:pk>/edit/', views.manage_stage, name='stage_edit'),
url(r'^stage/(?P<pk>\w+)/publication/$', views.publier_stage, path('stage/<int:pk>/publication/', views.publier_stage,
name='stage_publication'), name='stage_publication'),
url(r'^403/archicubes/$', views.archicubes_interdits, path('403/archicubes/', views.archicubes_interdits,
name='403-archicubes'), name='403-archicubes'),
url(r'^lieu/save/$', views.save_lieu, name='lieu_ajout'), path('lieu/save/', views.save_lieu, name='lieu_ajout'),
url(r'^profil/show/(?P<username>[\w@]+)/$', views.ProfilView.as_view(), path('profil/show/<str:username>/', views.ProfilView.as_view(),
name='profil'), name='profil'),
url(r'^profil/edit/$', views.ProfilEdit.as_view(), name='profil_edit'), path('profil/edit/', views.ProfilEdit.as_view(), name='profil_edit'),
url(r'^recherche/$', views.recherche, name='recherche'), path('recherche/', views.recherche, name='recherche'),
url(r'^recherche/resultats/$', views.recherche_resultats, path('recherche/resultats/', views.recherche_resultats,
name='recherche_resultats'), name='recherche_resultats'),
url(r'^recherche/items/$', views.stage_items, name='stage_items'), path('recherche/items/', views.stage_items, name='stage_items'),
url(r'^feedback/$', views.feedback, name='feedback'), path('feedback/', views.feedback, name='feedback'),
url(r'^moderation/$', views.statistiques, name='moderation'), path('moderation/', views.statistiques, name='moderation'),
url(r'^api/', include(v1_api.urls)), 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, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os 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 from .secrets import SECRET_KEY, GOOGLE_API_KEY, MAPBOX_API_KEY
@ -53,12 +53,12 @@ INSTALLED_APPS = [
'avisstage' 'avisstage'
] ]
MIDDLEWARE_CLASSES = ( MIDDLEWARE = (
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
) )

View file

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

View file

@ -1,19 +1,19 @@
from django.conf import settings from django.conf import settings
from django.conf.urls import include, url from django.urls import include, path
from django.contrib import admin from django.contrib import admin
urlpatterns = [ 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')), path('tinymce/', include('tinymce.urls')),
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')), path('taggit_autosuggest/', include('taggit_autosuggest.urls')),
url(r'^admin/', include(admin.site.urls)), path('admin/', admin.site.urls),
] ]
if settings.DEBUG: if settings.DEBUG:
import debug_toolbar import debug_toolbar
urlpatterns = [ urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)), path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns ] + urlpatterns

View file

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