Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
memopol
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Political Memory
memopol
Commits
c19407cb
Commit
c19407cb
authored
Feb 09, 2016
by
Jamesie Pic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added autocomplete for Proposal
parent
bbb804bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
representatives_votes/autocompletes.py
representatives_votes/autocompletes.py
+19
-0
representatives_votes/urls.py
representatives_votes/urls.py
+12
-0
No files found.
representatives_votes/autocompletes.py
0 → 100644
View file @
c19407cb
from
dal
import
autocomplete
from
django.db.models
import
Q
from
models
import
Proposal
class
ProposalAutocomplete
(
autocomplete
.
Select2QuerySetView
):
def
get_queryset
(
self
):
qs
=
Proposal
.
objects
.
all
()
if
self
.
q
:
qs
=
qs
.
filter
(
Q
(
dossier__title__icontains
=
self
.
q
)
|
Q
(
title__icontains
=
self
.
q
)
|
Q
(
reference__icontains
=
self
.
q
)
)
return
qs
representatives_votes/urls.py
View file @
c19407cb
from
django.conf
import
settings
from
django.conf.urls
import
url
import
views
...
...
@@ -14,3 +15,14 @@ urlpatterns = [
name
=
'dossier-list'
),
]
if
'dal_select2'
in
settings
.
INSTALLED_APPS
:
from
autocompletes
import
ProposalAutocomplete
# noqa
urlpatterns
.
append
(
url
(
'autocomplete/proposal/$'
,
ProposalAutocomplete
.
as_view
(),
name
=
'proposal-autocomplete'
,
),
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment