diff --git a/memopol/settings.py b/memopol/settings.py index b20df0bd5a71267f87c930e8ba41810a92dcb49d..ee3c732922b53951a5f0742a11a90019b148bee5 100644 --- a/memopol/settings.py +++ b/memopol/settings.py @@ -65,6 +65,7 @@ ORGANIZATION_NAME = os.environ.get('ORGANIZATION', 'Memopol Demo') INSTALLED_APPS = ( # 'django.contrib.admin', + 'autocomplete_light', # Instead of contrib.admin to use Django-Admin-Plus 'django.contrib.admin.apps.SimpleAdminConfig', 'django.contrib.auth', diff --git a/memopol/urls.py b/memopol/urls.py index 433abd3736bd8718d95dcbd630f12d67c209a7c7..4f0281b7377920662c4afca6d1e2de9fb0f47bb0 100644 --- a/memopol/urls.py +++ b/memopol/urls.py @@ -34,5 +34,6 @@ urlpatterns = patterns('', url(r'^legislature/', include('legislature.urls', namespace='legislature')), url(r'^votes/', include('votes.urls', namespace='votes')), url(r'^positions/', include('positions.urls', namespace='positions')), + url(r'^autocomplete/', include('autocomplete_light.urls')), url(r'^admin/', include(admin.site.urls)), ) diff --git a/requirements.txt b/requirements.txt index d9c25d35dac32407de2259c85e5c4e1f9313c9d0..71454901e7f2005ef4d2b463ff95f8f6d8930057 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,3 +22,4 @@ django-extensions django-debug-toolbar redis djangorestframework +django-autocomplete-light diff --git a/votes/admin.py b/votes/admin.py index 05d5b5dadd2093317db6c84d37ce94015ff10a07..52af5be036a869037c63445fc502dd4ac688c8d8 100644 --- a/votes/admin.py +++ b/votes/admin.py @@ -1,24 +1,7 @@ # coding: utf-8 - -# This file is part of memopol. -# -# memopol is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of -# the License, or any later version. -# -# memopol is distributed in the hope that it will -# be useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU General Affero Public -# License along with django-representatives. -# If not, see . -# -# Copyright (C) 2015 Arnaud Fabre from __future__ import absolute_import +from autocomplete_light import shortcuts as ac from django.contrib import admin from django.core.urlresolvers import reverse @@ -54,13 +37,13 @@ class MemopolDossierAdmin(admin.ModelAdmin): class RecommendationsAdmin(admin.ModelAdmin): - def link_to_proposal(self): return link_to_edit(self, 'proposal') link_to_proposal.allow_tags = True list_display = ('id', 'title', link_to_proposal, 'recommendation','weight') search_fields = ('title', 'recommendation', 'proposal') + form = ac.modelform_factory(Recommendation, exclude=[]) admin.site.register(MemopolDossier, MemopolDossierAdmin) admin.site.register(Recommendation, RecommendationsAdmin)