├── store ├── __init__.py ├── migrations │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-35.pyc │ │ ├── 0001_initial.cpython-35.pyc │ │ └── 0002_auto_20181127_1233.cpython-35.pyc │ ├── 0002_auto_20181127_1233.py │ └── 0001_initial.py ├── tests.py ├── urls.py ├── apps.py ├── __pycache__ │ ├── admin.cpython-35.pyc │ ├── apis.cpython-35.pyc │ ├── forms.cpython-35.pyc │ ├── tasks.cpython-35.pyc │ ├── views.cpython-35.pyc │ ├── __init__.cpython-35.pyc │ ├── consts.cpython-35.pyc │ ├── models.cpython-35.pyc │ └── serializers.cpython-35.pyc ├── consts.py ├── admin.py ├── templates │ ├── store │ │ ├── signin.html │ │ ├── store_signup.html │ │ ├── create_task.html │ │ ├── store_accunt.html │ │ ├── base_signup.html │ │ ├── base.html │ │ └── tasks.html │ ├── deliver │ │ ├── signin.html │ │ ├── delivery_boy_signup.html │ │ ├── store_signup.html │ │ ├── store_accunt.html │ │ ├── delivery_boy_account.html │ │ ├── base_signup.html │ │ ├── base.html │ │ └── tasks.html │ ├── base.html │ ├── base_signup.html │ ├── custom_404_view.html │ └── celery.html ├── serializers.py ├── consumers.py ├── tasks.py ├── forms.py ├── models.py ├── apis.py └── views.py ├── runtime.txt ├── Procfile ├── db.sqlite3 ├── static ├── images │ ├── res.jpg │ ├── exam.jpg │ ├── Screenshot from 2018-11-27 17-24-59.png │ ├── Screenshot from 2018-11-27 17-25-19.png │ ├── Screenshot from 2018-11-27 17-25-38.png │ ├── Screenshot from 2018-11-27 17-26-27.png │ ├── Screenshot from 2018-11-27 17-26-48.png │ └── Screenshot from 2018-11-27 17-49-34.png ├── font │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── js │ ├── npm.js │ ├── index.js │ ├── reconnecting-websocket.min.js │ ├── validate.js │ └── bootstrap.min.js └── css │ ├── style.css │ ├── bootstrap-theme.min.css.map │ ├── bootstrap-theme.min.css │ └── bootstrap-theme.css ├── delivery ├── __pycache__ │ ├── asgi.cpython-35.pyc │ ├── urls.cpython-35.pyc │ ├── wsgi.cpython-35.pyc │ ├── celery.cpython-35.pyc │ ├── routing.cpython-35.pyc │ ├── __init__.cpython-35.pyc │ └── settings.cpython-35.pyc ├── __init__.py ├── routing.py ├── celery.py ├── asgi.py ├── wsgi.py ├── urls.py ├── settings.py.save └── settings.py ├── req.txt ├── requirements.txt ├── templates ├── store │ ├── task_details.html │ ├── signin.html │ ├── signup.html │ ├── store_account.html │ ├── base_signup.html │ ├── task.html │ └── base.html ├── deliver │ ├── signin.html │ ├── delivery_boy_signup.html │ ├── delivery_boy_account.html │ ├── base_signup.html │ ├── base.html │ └── tasks.html ├── registration │ ├── login.html │ ├── signup.html │ ├── store_accunt.html │ ├── base_signup.html │ ├── base.html │ └── task.html ├── base.html └── base_signup.html ├── manage.py └── README.md /store/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.6.7 2 | -------------------------------------------------------------------------------- /store/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn delivery.wsgi --log-file- 2 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/db.sqlite3 -------------------------------------------------------------------------------- /store/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /static/images/res.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/images/res.jpg -------------------------------------------------------------------------------- /static/images/exam.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/images/exam.jpg -------------------------------------------------------------------------------- /store/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url, inlcude 2 | from rest_framework import routers 3 | 4 | -------------------------------------------------------------------------------- /store/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class StoreConfig(AppConfig): 5 | name = 'store' 6 | -------------------------------------------------------------------------------- /store/__pycache__/admin.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/admin.cpython-35.pyc -------------------------------------------------------------------------------- /store/__pycache__/apis.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/apis.cpython-35.pyc -------------------------------------------------------------------------------- /store/__pycache__/forms.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/forms.cpython-35.pyc -------------------------------------------------------------------------------- /store/__pycache__/tasks.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/tasks.cpython-35.pyc -------------------------------------------------------------------------------- /store/__pycache__/views.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/views.cpython-35.pyc -------------------------------------------------------------------------------- /delivery/__pycache__/asgi.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/delivery/__pycache__/asgi.cpython-35.pyc -------------------------------------------------------------------------------- /delivery/__pycache__/urls.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/delivery/__pycache__/urls.cpython-35.pyc -------------------------------------------------------------------------------- /delivery/__pycache__/wsgi.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/delivery/__pycache__/wsgi.cpython-35.pyc -------------------------------------------------------------------------------- /store/__pycache__/__init__.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/__init__.cpython-35.pyc -------------------------------------------------------------------------------- /store/__pycache__/consts.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/consts.cpython-35.pyc -------------------------------------------------------------------------------- /store/__pycache__/models.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/models.cpython-35.pyc -------------------------------------------------------------------------------- /delivery/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .celery import app as celery_app 3 | 4 | __all__ = ['celery_app'] -------------------------------------------------------------------------------- /delivery/__pycache__/celery.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/delivery/__pycache__/celery.cpython-35.pyc -------------------------------------------------------------------------------- /delivery/__pycache__/routing.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/delivery/__pycache__/routing.cpython-35.pyc -------------------------------------------------------------------------------- /delivery/__pycache__/__init__.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/delivery/__pycache__/__init__.cpython-35.pyc -------------------------------------------------------------------------------- /delivery/__pycache__/settings.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/delivery/__pycache__/settings.cpython-35.pyc -------------------------------------------------------------------------------- /static/font/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/font/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /static/font/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/font/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /static/font/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/font/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /static/font/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/font/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /store/__pycache__/serializers.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/__pycache__/serializers.cpython-35.pyc -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /store/consts.py: -------------------------------------------------------------------------------- 1 | validation_messages = { 2 | "DUPLICATE_STORE": "Duplicate store found", 3 | "DUPLICATE_NUMBER": "Duplicate Number found", 4 | } -------------------------------------------------------------------------------- /static/images/Screenshot from 2018-11-27 17-24-59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/images/Screenshot from 2018-11-27 17-24-59.png -------------------------------------------------------------------------------- /static/images/Screenshot from 2018-11-27 17-25-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/images/Screenshot from 2018-11-27 17-25-19.png -------------------------------------------------------------------------------- /static/images/Screenshot from 2018-11-27 17-25-38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/images/Screenshot from 2018-11-27 17-25-38.png -------------------------------------------------------------------------------- /static/images/Screenshot from 2018-11-27 17-26-27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/images/Screenshot from 2018-11-27 17-26-27.png -------------------------------------------------------------------------------- /static/images/Screenshot from 2018-11-27 17-26-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/images/Screenshot from 2018-11-27 17-26-48.png -------------------------------------------------------------------------------- /static/images/Screenshot from 2018-11-27 17-49-34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/static/images/Screenshot from 2018-11-27 17-49-34.png -------------------------------------------------------------------------------- /store/migrations/__pycache__/__init__.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/migrations/__pycache__/__init__.cpython-35.pyc -------------------------------------------------------------------------------- /store/migrations/__pycache__/0001_initial.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/migrations/__pycache__/0001_initial.cpython-35.pyc -------------------------------------------------------------------------------- /store/migrations/__pycache__/0002_auto_20181127_1233.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bs1278/delivery/HEAD/store/migrations/__pycache__/0002_auto_20181127_1233.cpython-35.pyc -------------------------------------------------------------------------------- /req.txt: -------------------------------------------------------------------------------- 1 | Django 2 | gunicorn==19.6.0 3 | whitenoise==3.2.1 4 | dj-database-url==0.4.1 5 | djangorestframework 6 | django-rest-framework-social-oauth2==1.0.4 7 | django-bootstrap3==7.0.1 8 | celery==3.1.23 9 | 10 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django 2 | gunicorn==19.6.0 3 | whitenoise==3.2.1 4 | dj-database-url==0.4.1 5 | djangorestframework 6 | django-rest-framework-social-oauth2==1.0.4 7 | django-bootstrap3==7.0.1 8 | celery==3.1.23 9 | 10 | -------------------------------------------------------------------------------- /store/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from store.models import Store, Task,DeliveryBoy 3 | # Register your models here. 4 | 5 | 6 | admin.site.register(Store) 7 | admin.site.register(Task) 8 | admin.site.register(DeliveryBoy) -------------------------------------------------------------------------------- /delivery/routing.py: -------------------------------------------------------------------------------- 1 | from channels import route 2 | from store import consumers 3 | 4 | ASGI_APPLICATION = "delivery.asgi.application" 5 | 6 | channel_routing = [ 7 | # websocket channels to store consumers 8 | 9 | route("websocket.connect", consumers.ws_connect), 10 | route("websocket.receive", consumers.ws_receive), 11 | ] -------------------------------------------------------------------------------- /delivery/celery.py: -------------------------------------------------------------------------------- 1 | import os 2 | from celery import Celery 3 | from django.conf import settings 4 | 5 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'delivery.settings') 6 | 7 | app = Celery('delivery') 8 | app.config_from_object('django.conf:settings') 9 | app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) 10 | 11 | @app.task(bind=True) 12 | def debug_task(self): 13 | print('Request: {!r}'.format(self.request)) -------------------------------------------------------------------------------- /templates/store/task_details.html: -------------------------------------------------------------------------------- 1 | {% extends 'store/base.html' %} 2 | {% load bootstrap3 %} 3 | 4 | {% block page %} 5 |
| Id | 15 |Title | 16 |Preiority | 17 |Status | 18 |Delivery Boy | 19 |Created | 20 |Accepted | 21 |
|---|---|---|---|---|---|---|
| {{ order.id }} | 27 |28 | {% for od in order.order_details.all %} 29 | {{ od.meal.name }} {{ od.meal.price }} 30 | x {{ od.quantity }} = ${{ od.sub_total }} 31 | {% endfor %} 32 | | 33 |{{ order.customer }} | 34 |{{ order.driver }} | 35 |{{ order.total }} | 36 |{{ order.get_status_display }} | 37 | 38 |
| Id | 15 |Order Details | 16 |Customer | 17 |Driver | 18 |Total | 19 |Status | 20 |Action | 21 |
|---|---|---|---|---|---|---|
| {{ order.id }} | 27 |28 | {% for od in order.order_details.all %} 29 | {{ od.meal.name }} {{ od.meal.price }} 30 | x {{ od.quantity }} = ${{ od.sub_total }} 31 | {% endfor %} 32 | | 33 |{{ order.customer }} | 34 |{{ order.driver }} | 35 |{{ order.total }} | 36 |{{ order.get_status_display }} | 37 |38 | {% if order.status == 1 %} 39 | 44 | {% endif %} 45 | | 46 |
| Id | 15 |Title | 16 |Preiority | 17 |Delivery Boy | 18 |Created At | 19 |Accepted At | 20 |Status | 21 |Act | 22 ||||
|---|---|---|---|---|---|---|---|---|---|---|
| {{ task.id }} | 28 |{{ task.title }} | 29 |{{ task.preiority }} | 30 |{{ task.delivery_boy }} | 31 |{{ task.created_at }} | 32 |{{ task.accepted_at }} | 33 | {% if task.status %} 34 | {% if task.status == 'READY' %} 35 |{{ task.status }} | 36 | {% else %}{% endif %} 37 | {% if task.status == 'COMPLETED' %} 38 |{{ task.status }} | 39 | {% else %}{% endif %} 40 | {% if task.status == 'REJECTED' %} 41 |{{ task.status }} | 42 | {% else %}{% endif %} 43 | {% if task.status == 'ACCEPTED' %} 44 |{{ task.status }} | 45 | {% else %}{% endif %} 46 | {% endif %} 47 |Modify | 48 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/store/tasks.py:
--------------------------------------------------------------------------------
1 | from __future__ import absolute_import
2 | import time
3 | import json
4 | import logging
5 | from django.http import JsonResponse
6 | from django.http.response import HttpResponse
7 | from django.views.decorators.csrf import csrf_exempt
8 | from django.db import transaction
9 | from django.contrib.auth.models import User
10 | from channels import Channel
11 | from celery import shared_task
12 | from celery.utils.log import get_task_logger
13 | from store.models import Store, Task, DeliveryBoy
14 | from store.serializers import TaskSerializer
15 | from delivery.celery import app
16 |
17 |
18 | log = logging.getLogger(__name__)
19 | logger = get_task_logger(__name__)
20 |
21 |
22 | @app.task
23 | def deliver_task_accept_notification(task_id, reply_channel):
24 | task = Task.objects.get(pk=task_id)
25 | log.debug("Running Task_name=%s", task.title)
26 | task.status = Task.ACCEPTED
27 | task.save()
28 |
29 | # send status update back to browser client
30 |
31 | if reply_channel is not None:
32 | Channel(replay_channel).send({
33 | "text": json.dumps({
34 | "action": "deliver_task_accept_notification",
35 | "task_id": task_id,
36 | "task_name": task.title,
37 | "task_status": task.status,
38 | "task_preiority": task.preiority,
39 | "task_store": task.store,
40 | })
41 | })
42 |
43 |
44 | @app.task
45 | def store_manager_created_new_task(task_id, reply_channel):
46 | task = Task.objects.get(pk=task_id)
47 | log.debug("Running Task Name=%s", task.title)
48 | if reply_channel is not None:
49 | Channel(reply_channel).send({
50 | "text": json.dumps({
51 | "action": "task_created",
52 | "task_id": task_id,
53 | "task_title": task.title,
54 | "task_status": task.status,
55 | "task_preiority": task.preiority,
56 | "task_store": task.store
57 | })
58 | })
59 |
60 |
61 | @app.task
62 | def deliver_task_reject_notification(task_id, reply_channel):
63 | task = Task.objects.get(pk=task_id)
64 | log.debug("Running Task Name=%s", task.title)
65 | if reply_channel is not None:
66 | Channel(reply_channel).send({
67 | "text": json.dumps({
68 | "action": "accepted",
69 | "task_id": task_id,
70 | "task_name": task.title,
71 | "task_status": task.status,
72 | "task_preiority": task.preiority,
73 | "task_store": task.store,
74 | })
75 | })
76 |
77 |
78 | @app.task
79 | def deliver_task_completed_notification(task_id, reply_channel):
80 | task = Task.objects.get(pk=task_id)
81 | log.debug("Running Task Name=%s", task.title)
82 | if reply_channel is not None:
83 | Channel(reply_channel).send({
84 | "text": json.dumps({
85 | "action": "accepted",
86 | "task_id": task_id,
87 | "task_name": task.title,
88 | "task_status": task.status,
89 | "task_preiority": task.preiority,
90 | "task_store": task.store,
91 | })
92 | })
--------------------------------------------------------------------------------
/store/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 2.1.3 on 2018-11-26 13:29
2 |
3 | from django.conf import settings
4 | from django.db import migrations, models
5 | import django.db.models.deletion
6 |
7 |
8 | class Migration(migrations.Migration):
9 |
10 | initial = True
11 |
12 | dependencies = [
13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14 | ]
15 |
16 | operations = [
17 | migrations.CreateModel(
18 | name='DeliveryBoy',
19 | fields=[
20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21 | ('number', models.CharField(max_length=12, unique=True)),
22 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='delivery_boy', to=settings.AUTH_USER_MODEL)),
23 | ],
24 | options={
25 | 'verbose_name': 'Delivery Boy',
26 | 'verbose_name_plural': 'Delivery Boys',
27 | },
28 | ),
29 | migrations.CreateModel(
30 | name='Store',
31 | fields=[
32 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
33 | ('store_name', models.CharField(max_length=150)),
34 | ('contact_number', models.CharField(max_length=12)),
35 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='store', to=settings.AUTH_USER_MODEL)),
36 | ],
37 | options={
38 | 'verbose_name': 'Store Manager',
39 | 'verbose_name_plural': 'Store Managers',
40 | },
41 | ),
42 | migrations.CreateModel(
43 | name='Task',
44 | fields=[
45 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
46 | ('title', models.CharField(max_length=100)),
47 | ('preiority', models.CharField(choices=[('HIGH', 'High'), ('MEDIUM', 'Medium'), ('LOW', 'Low')], max_length=6)),
48 | ('status', models.CharField(choices=[('READY', 'Ready'), ('ACCEPTED', 'Accepted'), ('COMPLETED', 'Completed'), ('REJECTED', 'Rejected'), ('CANCELD', 'Canceld')], max_length=10)),
49 | ('created_at', models.DateTimeField(auto_now=True)),
50 | ('accepted_at', models.DateTimeField(blank=True, null=True)),
51 | ('edited_at', models.DateTimeField(auto_now_add=True)),
52 | ('delivery_boy', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='store.DeliveryBoy')),
53 | ('store', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='store.Store')),
54 | ],
55 | options={
56 | 'verbose_name': 'Delivery Task',
57 | 'verbose_name_plural': 'Delivery Tasks',
58 | },
59 | ),
60 | ]
61 |
--------------------------------------------------------------------------------
/static/js/reconnecting-websocket.min.js:
--------------------------------------------------------------------------------
1 | !function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.ReconnectingWebSocket=b()}(this,function(){function a(b,c,d){function l(a,b){var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!1,!1,b),c}var e={debug:!1,automaticOpen:!0,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1.5,timeoutInterval:2e3};d||(d={});for(var f in e)this[f]="undefined"!=typeof d[f]?d[f]:e[f];this.url=b,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var h,g=this,i=!1,j=!1,k=document.createElement("div");k.addEventListener("open",function(a){g.onopen(a)}),k.addEventListener("close",function(a){g.onclose(a)}),k.addEventListener("connecting",function(a){g.onconnecting(a)}),k.addEventListener("message",function(a){g.onmessage(a)}),k.addEventListener("error",function(a){g.onerror(a)}),this.addEventListener=k.addEventListener.bind(k),this.removeEventListener=k.removeEventListener.bind(k),this.dispatchEvent=k.dispatchEvent.bind(k),this.open=function(b){h=new WebSocket(g.url,c||[]),b||k.dispatchEvent(l("connecting")),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",g.url);var d=h,e=setTimeout(function(){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",g.url),j=!0,d.close(),j=!1},g.timeoutInterval);h.onopen=function(){clearTimeout(e),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onopen",g.url),g.protocol=h.protocol,g.readyState=WebSocket.OPEN,g.reconnectAttempts=0;var d=l("open");d.isReconnect=b,b=!1,k.dispatchEvent(d)},h.onclose=function(c){if(clearTimeout(e),h=null,i)g.readyState=WebSocket.CLOSED,k.dispatchEvent(l("close"));else{g.readyState=WebSocket.CONNECTING;var d=l("connecting");d.code=c.code,d.reason=c.reason,d.wasClean=c.wasClean,k.dispatchEvent(d),b||j||((g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onclose",g.url),k.dispatchEvent(l("close")));var e=g.reconnectInterval*Math.pow(g.reconnectDecay,g.reconnectAttempts);setTimeout(function(){g.reconnectAttempts++,g.open(!0)},e>g.maxReconnectInterval?g.maxReconnectInterval:e)}},h.onmessage=function(b){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",g.url,b.data);var c=l("message");c.data=b.data,k.dispatchEvent(c)},h.onerror=function(b){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onerror",g.url,b),k.dispatchEvent(l("error"))}},1==this.automaticOpen&&this.open(!1),this.send=function(b){if(h)return(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","send",g.url,b),h.send(b);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(a,b){"undefined"==typeof a&&(a=1e3),i=!0,h&&h.close(a,b)},this.refresh=function(){h&&h.close()}}return a.prototype.onopen=function(){},a.prototype.onclose=function(){},a.prototype.onconnecting=function(){},a.prototype.onmessage=function(){},a.prototype.onerror=function(){},a.debugAll=!1,a.CONNECTING=WebSocket.CONNECTING,a.OPEN=WebSocket.OPEN,a.CLOSING=WebSocket.CLOSING,a.CLOSED=WebSocket.CLOSED,a});
2 |
--------------------------------------------------------------------------------
/delivery/urls.py:
--------------------------------------------------------------------------------
1 | """delivery URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.conf.urls import url, include
14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15 | """
16 | from django.conf.urls import url, include, handler404
17 | from django.contrib import admin
18 | from django.conf import settings
19 | from django.conf.urls.static import static
20 | from django.contrib.auth import views as auth_views
21 | from django.contrib.auth import views as deliver_views
22 | from store import views, apis
23 |
24 |
25 |
26 | urlpatterns = [
27 | url(r'^admin/', admin.site.urls),
28 | # url(r'^celery/', views.celery_task_checker, name='celery_task_checker'),
29 |
30 | url(r'^api_auth_token/', views.get_auth_token),
31 |
32 | url(r'^store/signin/', auth_views.LoginView.as_view(),{'template_name':'store/signin.html'}, name="store-signin" ),
33 | url(r'^store/signout', auth_views.LogoutView.as_view(),{'next_page': '/store/signin'}, name="store-signout"),
34 | url(r'^store/signup', views.store_signup, name="store-signup"),
35 | url(r'^store/$', views.store_home, name='store_home'),
36 |
37 | url(r'^store/accounts/$', views.store_account, name='store_account'),
38 | url(r'^store/tasks/$', views.store_tasks, name="store_tasks"),
39 | url(r'^store/tasks/details/(?P| Task ID | 45 |Task Name | 46 |Task Status | 47 |
|---|
| Id | 15 |Title | 16 |Store | 17 |Preiority | 18 |Action | 19 |Status | 20 |
|---|---|---|---|---|---|
| {{ task.id }} | 26 |{{ task.title }} | 27 |{{ task.store }} | 28 |{{ task.preiority}} | 29 |30 | 32 | | {{task.status}} | 33 |
| Id | 51 |Title | 52 |Store | 53 |Reject | 54 |Completed | 55 |Status | 56 |
|---|---|---|---|---|---|
| {{ task.id }} | 62 |{{ task.title }} | 63 |{{ task.store }} | 64 |65 | | 66 | | {{task.status}} | 67 |
| Id | 85 |Title | 86 |Store | 87 |Completed | 88 |
|---|---|---|---|
| {{ task.id }} | 94 |{{ task.title }} | 95 |{{ task.store }} | 96 |{{task.status}} | 97 |