Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajax search feature added #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arunjain9988
Copy link

Ajax search feature added to home page so that users will be able to know what can be searched.

@lgtm-com
Copy link

lgtm-com bot commented Nov 24, 2019

This pull request introduces 1 alert when merging 9a0fd1d into 324a9f1 - view on LGTM.com

new alerts:

  • 1 for Conflicting attributes in base classes

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.devbridge-autocomplete/1.4.10/jquery.autocomplete.min.js"></script>
<script>
$('#search-bar').autocomplete({
serviceUrl: '/autocomplete'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use url template tag?

Comment on lines +150 to +158
def autocomplete(request):
query = request.GET.get('query')
tags = Tag.objects.filter(name__icontains=query)
taglist = []
for t in tags:
taglist.append(t.name)
taglist_json = {"suggestions":taglist}
taglist_string = json.dumps(taglist_json)
return HttpResponse(taglist_string)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using json module, you could also have used Django's JsonResponse to send back a JSON object for autocomplete.

@Animesh-Ghosh
Copy link
Collaborator

There is also the issue of you sending a PR from your master branch. Please see CONTRIBUTING.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants