Commit 8d68889e authored by Jamesie Pic's avatar Jamesie Pic

Added proposal autocomplete, upgrade to DAL v3

parent 8eac5f5b
...@@ -69,7 +69,8 @@ ORGANIZATION_NAME = os.environ.get('ORGANIZATION', 'Memopol Demo') ...@@ -69,7 +69,8 @@ ORGANIZATION_NAME = os.environ.get('ORGANIZATION', 'Memopol Demo')
INSTALLED_APPS = ( INSTALLED_APPS = (
# 'django.contrib.admin', # 'django.contrib.admin',
'autocomplete_light', 'dal',
'dal_select2',
'suit', 'suit',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
......
...@@ -27,7 +27,6 @@ urlpatterns = [ ...@@ -27,7 +27,6 @@ urlpatterns = [
views.DossierList.as_view(), views.DossierList.as_view(),
), ),
url(r'^autocomplete/', include('autocomplete_light.urls')),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'legislature/', include('representatives.urls', url(r'legislature/', include('representatives.urls',
namespace='representatives')), namespace='representatives')),
......
...@@ -3,12 +3,13 @@ from __future__ import absolute_import ...@@ -3,12 +3,13 @@ from __future__ import absolute_import
from django.contrib import admin from django.contrib import admin
from .forms import RecommendationForm
from .models import Recommendation from .models import Recommendation
class RecommendationsAdmin(admin.ModelAdmin): class RecommendationsAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'proposal', 'recommendation', 'weight') list_display = ('id', 'title', 'proposal', 'recommendation', 'weight')
search_fields = ('title', 'recommendation', 'proposal') search_fields = ('title', 'recommendation', 'proposal')
raw_id_fields = ('proposal',) form = RecommendationForm
admin.site.register(Recommendation, RecommendationsAdmin) admin.site.register(Recommendation, RecommendationsAdmin)
from dal import autocomplete
from django import forms
from models import Recommendation
class RecommendationForm(forms.ModelForm):
class Meta:
model = Recommendation
fields = '__all__'
widgets = {
'proposal': autocomplete.ModelSelect2(
url='representatives_votes:proposal-autocomplete',
)
}
...@@ -9,13 +9,13 @@ setup(name='political-memory', ...@@ -9,13 +9,13 @@ setup(name='political-memory',
author_email='cortex@worlddomination.be', author_email='cortex@worlddomination.be',
url='http://github.com/political-memory/political_memory/', url='http://github.com/political-memory/political_memory/',
install_requires=[ install_requires=[
'django-autocomplete-light>=2.2,<3.0', 'django-autocomplete-light>=3.0',
'django-bootstrap3>=6.2,<6.3', 'django-bootstrap3>=6.2,<6.3',
'django-coffeescript>=0.7,<0.8', 'django-coffeescript>=0.7,<0.8',
'django-compressor>=1.6,<1.7', 'django-compressor>=1.6,<1.7',
'django-datetime-widget>=0.9,<1.0', 'django-datetime-widget>=0.9,<1.0',
'django-filter>=0.11,<0.12', 'django-filter>=0.11,<0.12',
'django-representatives-votes>=0.0.12', 'django-representatives-votes>=0.0.13',
'django-representatives>=0.0.14', 'django-representatives>=0.0.14',
'django-taggit>=0.17,<0.18', 'django-taggit>=0.17,<0.18',
'django>=1.8,<1.9', 'django>=1.8,<1.9',
......
{% extends "admin/base.html" %}
{% load static %}
{% block extrahead %}
<script type="text/javascript" src="{% static 'libs/jquery/dist/jquery.js' %}"></script>
{% include 'autocomplete_light/static.html' %}
{% endblock %}
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