From 04d8c263bf57483ea60e557f6079b8adff4f9f48 Mon Sep 17 00:00:00 2001 From: Tomislav R Date: Thu, 19 May 2016 00:58:28 +0200 Subject: [PATCH 1/2] add delete hosting order --- hosting/templates/hosting/orders.html | 139 ++++++++++++++++---------- hosting/urls.py | 3 +- hosting/views.py | 12 ++- 3 files changed, 100 insertions(+), 54 deletions(-) diff --git a/hosting/templates/hosting/orders.html b/hosting/templates/hosting/orders.html index 99c6464f..2b262de3 100644 --- a/hosting/templates/hosting/orders.html +++ b/hosting/templates/hosting/orders.html @@ -1,64 +1,101 @@ {% extends "hosting/base_short.html" %} {% load staticfiles bootstrap3 %} -{% block content %} +{% block content %} -
-
-
-
- -

My Orders

-
- - - - - - - - - - - {% for order in orders %} - - - - - - - - {% endfor %} - -
#DateAmountStatus
{{order.id}}{{order.created_at}}{{order.VMPlan.price}} CHF{% if order.approved %} - Approved - {% else%} - Declined - {% endif%} - - -
+
+
+
+
+ +

My Orders

+
+ + + + + + + + + + + {% for order in orders %} + + + + + + + + +
#DateAmountStatus
{{ order.id }}{{ order.created_at }}{{ order.VMPlan.price }} CHF{% if order.approved %} + Approved + {% else %} + Declined + {% endif %} + + + +
+ + {% if is_paginated %} + - {% endif %} +
+ {% endif %} -
+
-
-
+
+
-
+ -{%endblock%} \ No newline at end of file +{% endblock %} \ No newline at end of file diff --git a/hosting/urls.py b/hosting/urls.py index bb195b79..d280c904 100644 --- a/hosting/urls.py +++ b/hosting/urls.py @@ -3,7 +3,7 @@ from django.conf.urls import url from .views import DjangoHostingView, RailsHostingView, PaymentVMView, \ NodeJSHostingView, LoginView, SignupView, IndexView, \ OrdersHostingListView, OrdersHostingDetailView, VirtualMachinesPlanListView,\ - VirtualMachineDetailListView + VirtualMachineDetailListView,OrdersHostingDeleteView urlpatterns = [ # url(r'pricing/?$', VMPricingView.as_view(), name='pricing'), @@ -14,6 +14,7 @@ urlpatterns = [ url(r'payment/?$', PaymentVMView.as_view(), name='payment'), url(r'orders/?$', OrdersHostingListView.as_view(), name='orders'), url(r'orders/(?P\d+)/?$', OrdersHostingDetailView.as_view(), name='orders'), + url(r'cancel_order/(?P\d+)/?$',OrdersHostingDeleteView.as_view(),name='delete_order'), url(r'my-virtual-machines/?$', VirtualMachinesPlanListView.as_view(), name='virtual_machines'), url(r'my-virtual-machines/(?P\d+)/?$', VirtualMachineDetailListView.as_view(), name='virtual_machines'), diff --git a/hosting/views.py b/hosting/views.py index b0e76028..4157f936 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -3,7 +3,7 @@ from django.shortcuts import get_object_or_404, render from django.core.urlresolvers import reverse_lazy, reverse from django.contrib.auth.mixins import LoginRequiredMixin -from django.views.generic import View, CreateView, FormView, ListView, DetailView +from django.views.generic import View, CreateView, FormView, ListView, DetailView,DeleteView from django.http import HttpResponseRedirect from django.contrib.auth import authenticate, login from django.conf import settings @@ -124,7 +124,7 @@ class LoginView(FormView): class SignupView(CreateView): template_name = 'hosting/signup.html' form_class = HostingUserSignupForm - moodel = CustomUser + model = CustomUser def get_success_url(self): next_url = self.request.session.get('next', reverse_lazy('hosting:signup')) @@ -235,6 +235,14 @@ class OrdersHostingListView(LoginRequiredMixin, ListView): self.queryset = HostingOrder.objects.filter(customer__user=user) return super(OrdersHostingListView, self).get_queryset() +class OrdersHostingDeleteView(LoginRequiredMixin,DeleteView): + login_url=reverse_lazy('hosting:login') + success_url = reverse_lazy('hosting:orders') + model = HostingOrder + def get_queryset(self): + user = self.request.user + self.queryset = VirtualMachinePlan.objects.active(user) + return super(VirtualMachinesPlanListView, self).get_queryset() class VirtualMachinesPlanListView(LoginRequiredMixin, ListView): template_name = "hosting/virtual_machines.html" From 418c257978d4c3909f66845f73daa2a38b89b0a6 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 May 2016 15:00:06 +0000 Subject: [PATCH 2/2] delete orders --- dynamicweb/settings/base.py | 38 +++++++++++++++---------------------- hosting/views.py | 4 ---- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index de339f86..d681e9c9 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -84,18 +84,18 @@ INSTALLED_APPS = ( 'djangocms_file', 'djangocms_picture', 'djangocms_video', - 'djangocms_flash', - 'djangocms_googlemap', - 'djangocms_inherit', - 'djangocms_link', - 'djangocms_teaser', + # 'djangocms_flash', + # 'djangocms_googlemap', + # 'djangocms_inherit', + # 'djangocms_link', + # 'djangocms_teaser', 'djangocms_page_meta', 'djangocms_text_ckeditor', 'djangocms_admin_style', 'cmsplugin_filer_file', 'cmsplugin_filer_folder', 'cmsplugin_filer_link', - 'cmsplugin_filer_teaser', + # 'cmsplugin_filer_teaser', 'cmsplugin_filer_video', # # blog @@ -103,10 +103,9 @@ INSTALLED_APPS = ( 'reversion', # ungleich 'ungleich', -# 'ungleich_page', + 'ungleich_page', 'hosting', 'digitalglarus', - ) MIDDLEWARE_CLASSES = ( @@ -176,7 +175,7 @@ CMS_TEMPLATES = ( DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'app_new', + 'NAME': 'app', } } @@ -280,12 +279,12 @@ CACHES = { } } -#if LOGIN_URL is None: -# LOGIN_URL = APP_ROOT_ENDPOINT + 'login/' -#if LOGOUT_URL is None: -# LOGOUT_URL = APP_ROOT_ENDPOINT + 'logout/' -#if LOGIN_REDIRECT_URL is None: -# LOGIN_REDIRECT_URL = APP_ROOT_ENDPOINT +if LOGIN_URL is None: + LOGIN_URL = APP_ROOT_ENDPOINT + 'login/' +if LOGOUT_URL is None: + LOGOUT_URL = APP_ROOT_ENDPOINT + 'logout/' +if LOGIN_REDIRECT_URL is None: + LOGIN_REDIRECT_URL = APP_ROOT_ENDPOINT # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.7/howto/static-files/ @@ -302,7 +301,7 @@ META_SITE_PROTOCOL = 'http' META_USE_SITES = True MIGRATION_MODULES = { 'cms': 'cms.migrations', - #'filer': 'filer.migrations_django', + # 'filer': 'filer.migrations_django', # 'menus': 'menus.migrations_django', 'djangocms_flash': 'djangocms_flash.migrations_django', 'djangocms_googlemap': 'djangocms_googlemap.migrations_django', @@ -337,7 +336,6 @@ STATICFILES_FINDERS = ( THUMBNAIL_PROCESSORS = ( 'easy_thumbnails.processors.colorspace', 'easy_thumbnails.processors.autocrop', - #'easy_thumbnails.processors.scale_and_crop', 'filer.thumbnail_processors.scale_and_crop_with_subject_location', 'easy_thumbnails.processors.filters', ) @@ -443,12 +441,6 @@ PARLER_LANGUAGES = {1: ({'code': 'en-us'}, {'code': 'de'},)} AUTH_USER_MODEL = 'membership.CustomUser' - -ALLOWED_HOSTS = [ - "*" - ] - - # PAYMENT STRIPE_DESCRIPTION_ON_PAYMENT = "Payment for ungleich GmbH services" diff --git a/hosting/views.py b/hosting/views.py index b4441a54..fbeb36ea 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -244,10 +244,6 @@ class OrdersHostingDeleteView(LoginRequiredMixin,DeleteView): login_url=reverse_lazy('hosting:login') success_url = reverse_lazy('hosting:orders') model = HostingOrder - def get_queryset(self): - user = self.request.user - self.queryset = VirtualMachinePlan.objects.active(user) - return super(VirtualMachinesPlanListView, self).get_queryset() class VirtualMachinesPlanListView(LoginRequiredMixin, ListView): template_name = "hosting/virtual_machines.html"