2016-02-14 20:40:28 +00:00
|
|
|
from django.core.urlresolvers import reverse_lazy
|
|
|
|
from django.views.generic import ListView, DetailView, DeleteView, UpdateView, CreateView
|
2016-02-12 13:02:37 +00:00
|
|
|
|
2016-02-14 16:51:54 +00:00
|
|
|
from rest_framework import serializers, viewsets
|
|
|
|
|
2016-02-14 10:37:05 +00:00
|
|
|
from orders.models import Order
|
|
|
|
|
|
|
|
|
2016-02-14 16:27:22 +00:00
|
|
|
class OrderIndexView(ListView):
|
2016-02-14 10:37:05 +00:00
|
|
|
template_name = 'orders/order/index.html'
|
|
|
|
model = Order
|
2016-02-14 16:27:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
class OrderDetailView(DetailView):
|
|
|
|
template_name = 'orders/order/detail.html'
|
|
|
|
model = Order
|
2016-02-14 16:51:54 +00:00
|
|
|
|
|
|
|
|
2016-02-14 20:40:28 +00:00
|
|
|
class OrderDeleteView(DeleteView):
|
|
|
|
template_name = 'orders/order/delete.html'
|
|
|
|
model = Order
|
|
|
|
success_url = reverse_lazy('index')
|
|
|
|
|
|
|
|
|
|
|
|
class OrderUpdateView(UpdateView):
|
|
|
|
template_name = 'orders/order/update.html'
|
|
|
|
model = Order
|
|
|
|
success_url = reverse_lazy('index')
|
|
|
|
fields = ['marketplace', 'idFlux', 'order_mrid', 'order_refid', 'order_external_id',
|
|
|
|
'order_purchase', 'order_amount', 'order_tax', 'order_shipping', 'order_commission',
|
|
|
|
'order_processing_fee', 'order_comments', 'customer_id', 'order_ip', 'order_items']
|
|
|
|
|
|
|
|
|
|
|
|
class OrderCreateView(CreateView):
|
|
|
|
template_name = 'orders/order/create.html'
|
|
|
|
model = Order
|
|
|
|
success_url = reverse_lazy('index')
|
|
|
|
fields = ['marketplace', 'idFlux', 'order_mrid', 'order_refid', 'order_external_id',
|
|
|
|
'order_purchase', 'order_amount', 'order_tax', 'order_shipping', 'order_commission',
|
|
|
|
'order_processing_fee', 'order_comments', 'customer_id', 'order_ip', 'order_items']
|
|
|
|
|
|
|
|
|
2016-02-14 16:51:54 +00:00
|
|
|
class OrderSerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Order
|
|
|
|
fields = ('marketplace', 'idFlux', 'order_id', 'order_mrid', 'order_refid', 'order_external_id',
|
|
|
|
'order_purchase', 'order_amount', 'order_tax', 'order_shipping', 'order_commission',
|
|
|
|
'order_processing_fee', 'order_comments', 'customer_id', 'order_ip', 'order_items')
|
|
|
|
|
|
|
|
|
|
|
|
class OrderViewSet(viewsets.ModelViewSet):
|
|
|
|
queryset = Order.objects.all()
|
|
|
|
serializer_class = OrderSerializer
|