-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from Go-In/dev
Dev
- Loading branch information
Showing
30 changed files
with
5,592 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from haystack import indexes | ||
|
||
from storemanage.models import Ticket | ||
|
||
|
||
class ProductIndex(indexes.SearchIndex, indexes.Indexable): | ||
text = indexes.CharField(document=True, use_template=True) | ||
name = indexes.CharField(model_attr='name') | ||
|
||
def get_model(self): | ||
return Ticket | ||
|
||
def index_queryset(self, using=None): | ||
return self.get_model().objects.all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ object.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% include 'components/header.html' %} | ||
|
||
{% block content %} | ||
<h2>Search</h2> | ||
|
||
<form method="get" action="."> | ||
<table> | ||
{{ form.as_table }} | ||
<tr> | ||
<td> </td> | ||
<td> | ||
<input type="submit" value="Search"> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
{% if query %} | ||
<h3>Results</h3> | ||
|
||
{% for result in page.object_list %} | ||
<p> | ||
<a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a> | ||
</p> | ||
{% empty %} | ||
<p>No results found.</p> | ||
{% endfor %} | ||
|
||
{% if page.has_previous or page.has_next %} | ||
<div> | ||
{% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Previous{% if page.has_previous %}</a>{% endif %} | ||
| | ||
{% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Next »{% if page.has_next %}</a>{% endif %} | ||
</div> | ||
{% endif %} | ||
{% else %} | ||
{# Show some example queries to run, maybe query syntax, something else? #} | ||
{% endif %} | ||
</form> | ||
{% endblock %} | ||
|
||
{% include 'components/footer.html' %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,52 @@ | ||
from django.shortcuts import render | ||
from django.shortcuts import render, redirect | ||
from storemanage.models import Ticket | ||
|
||
from django.http import JsonResponse | ||
|
||
# Create your views here. | ||
def index(request): | ||
tickets = Ticket.objects.all() | ||
tickets = Ticket.objects.filter(available=True) | ||
return render(request, 'index/index.html', { | ||
'tickets': tickets | ||
}) | ||
|
||
def detail(request, ticket_id): | ||
success = request.session.get('success') | ||
if success: | ||
request.session['success'] = False | ||
ticket = Ticket.objects.get(pk=ticket_id) | ||
if ticket.available == False: | ||
return redirect('index:index') | ||
return render(request, 'index/detail.html', { | ||
'ticket' : ticket | ||
'ticket' : ticket, | ||
'success': success | ||
}) | ||
|
||
def cart(request): | ||
data = request.GET | ||
if 'cart' not in data: | ||
return redirect('index:index') | ||
items = data['cart'].split(',') if data['cart'] else [] | ||
tickets = Ticket.objects.filter(pk__in=items) | ||
return render(request, 'index/cart.html', { | ||
'tickets': tickets | ||
}) | ||
|
||
def catalog(request): | ||
tickets = Ticket.objects.filter(available=True) | ||
return render(request, 'index/catalog.html', { | ||
'tickets': tickets | ||
}) | ||
|
||
def search(request): | ||
return render(request, 'index/search.html') | ||
|
||
def searchDemo(request): | ||
data = request.POST | ||
name = data['search_name'] | ||
tickets = Ticket.objects.filter(name__search=name) | ||
for i in tickets: | ||
print(i.detail) | ||
return render(request, 'index/search-demo.html', { | ||
'tickets' : tickets | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.