Optims BDD
This commit is contained in:
parent
7184cc287d
commit
eac3d622aa
4 changed files with 13 additions and 2 deletions
|
@ -54,6 +54,7 @@ class StageView(LoginRequiredMixin, DetailView):
|
|||
filtre = Q(auteur__user_id=self.request.user.id) | Q(public=True)
|
||||
return Stage.objects.filter(filtre)
|
||||
|
||||
|
||||
# Liste des stages par dernière modification
|
||||
#login_required
|
||||
class StageListe(LoginRequiredMixin, ListView):
|
||||
|
|
|
@ -138,6 +138,7 @@ def recherche_resultats(request):
|
|||
form = SearchForm(request.GET)
|
||||
if form.is_valid():
|
||||
stages, tri = cherche(**form.cleaned_data)
|
||||
stages = stages.prefetch_related('lieux', 'auteur', 'matieres', 'thematiques')
|
||||
lieux = map(list, stages.values_list('id', 'lieux'))
|
||||
else:
|
||||
form = SearchForm()
|
||||
|
|
|
@ -15,9 +15,11 @@ INSTALLED_APPS += (
|
|||
'debug_toolbar',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES += (
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
)
|
||||
) + MIDDLEWARE_CLASSES
|
||||
|
||||
INTERNAL_IPS = ['127.0.0.1']
|
||||
|
||||
SPATIALITE_LIBRARY_PATH = 'mod_spatialite'
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
|
||||
|
@ -12,3 +13,9 @@ urlpatterns = [
|
|||
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
import debug_toolbar
|
||||
urlpatterns = [
|
||||
url(r'^__debug__/', include(debug_toolbar.urls)),
|
||||
] + urlpatterns
|
||||
|
|
Loading…
Reference in a new issue