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
1e3bf2c9
Commit
1e3bf2c9
authored
Feb 17, 2016
by
James Pic
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request
#17
from political-memory/dossier_autocomplete
Added dossier autocomplete view
parents
2e45c93a
546c0b97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
representatives_votes/autocompletes.py
representatives_votes/autocompletes.py
+14
-1
representatives_votes/urls.py
representatives_votes/urls.py
+11
-3
No files found.
representatives_votes/autocompletes.py
View file @
1e3bf2c9
...
...
@@ -2,7 +2,20 @@ from dal import autocomplete
from
django.db.models
import
Q
from
models
import
Proposal
from
models
import
Dossier
,
Proposal
class
DossierAutocomplete
(
autocomplete
.
Select2QuerySetView
):
def
get_queryset
(
self
):
qs
=
Dossier
.
objects
.
all
()
if
self
.
q
:
qs
=
qs
.
filter
(
Q
(
title__icontains
=
self
.
q
)
|
Q
(
reference__icontains
=
self
.
q
)
)
return
qs
class
ProposalAutocomplete
(
autocomplete
.
Select2QuerySetView
):
...
...
representatives_votes/urls.py
View file @
1e3bf2c9
...
...
@@ -17,12 +17,20 @@ urlpatterns = [
]
if
'dal_select2'
in
settings
.
INSTALLED_APPS
:
from
autocompletes
import
ProposalAutocomplete
# noqa
from
autocompletes
import
(
# noqa
DossierAutocomplete
,
ProposalAutocomplete
,
)
urlpatterns
.
append
(
urlpatterns
+=
[
url
(
'^autocomplete/dossier/$'
,
DossierAutocomplete
.
as_view
(),
name
=
'dossier-autocomplete'
,
),
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