Commit 22519fc3 authored by Jamesie Pic's avatar Jamesie Pic

Added autocompletes for dossier

parent c0c4d714
...@@ -65,6 +65,7 @@ ORGANIZATION_NAME = os.environ.get('ORGANIZATION', 'Memopol Demo') ...@@ -65,6 +65,7 @@ ORGANIZATION_NAME = os.environ.get('ORGANIZATION', 'Memopol Demo')
INSTALLED_APPS = ( INSTALLED_APPS = (
# 'django.contrib.admin', # 'django.contrib.admin',
'autocomplete_light',
# Instead of contrib.admin to use Django-Admin-Plus # Instead of contrib.admin to use Django-Admin-Plus
'django.contrib.admin.apps.SimpleAdminConfig', 'django.contrib.admin.apps.SimpleAdminConfig',
'django.contrib.auth', 'django.contrib.auth',
......
...@@ -34,5 +34,6 @@ urlpatterns = patterns('', ...@@ -34,5 +34,6 @@ urlpatterns = patterns('',
url(r'^legislature/', include('legislature.urls', namespace='legislature')), url(r'^legislature/', include('legislature.urls', namespace='legislature')),
url(r'^votes/', include('votes.urls', namespace='votes')), url(r'^votes/', include('votes.urls', namespace='votes')),
url(r'^positions/', include('positions.urls', namespace='positions')), url(r'^positions/', include('positions.urls', namespace='positions')),
url(r'^autocomplete/', include('autocomplete_light.urls')),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
) )
# coding: utf-8 # 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 <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2015 Arnaud Fabre <af@laquadrature.net>
from __future__ import absolute_import from __future__ import absolute_import
from autocomplete_light import shortcuts as ac
from django.contrib import admin from django.contrib import admin
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -54,13 +37,13 @@ class MemopolDossierAdmin(admin.ModelAdmin): ...@@ -54,13 +37,13 @@ class MemopolDossierAdmin(admin.ModelAdmin):
class RecommendationsAdmin(admin.ModelAdmin): class RecommendationsAdmin(admin.ModelAdmin):
def link_to_proposal(self): def link_to_proposal(self):
return link_to_edit(self, 'proposal') return link_to_edit(self, 'proposal')
link_to_proposal.allow_tags = True link_to_proposal.allow_tags = True
list_display = ('id', 'title', link_to_proposal, 'recommendation','weight') list_display = ('id', 'title', link_to_proposal, 'recommendation','weight')
search_fields = ('title', 'recommendation', 'proposal') search_fields = ('title', 'recommendation', 'proposal')
form = ac.modelform_factory(Recommendation, exclude=[])
admin.site.register(MemopolDossier, MemopolDossierAdmin) admin.site.register(MemopolDossier, MemopolDossierAdmin)
admin.site.register(Recommendation, RecommendationsAdmin) admin.site.register(Recommendation, RecommendationsAdmin)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment