From 1c0f0da96eb3bb84d4adada1f563474c341bbd23 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Thu, 21 Sep 2017 19:32:22 +0530 Subject: [PATCH] conditional texts --- hosting/locale/de/LC_MESSAGES/django.po | 75 +++++++++++++++------ hosting/templates/hosting/order_detail.html | 8 ++- hosting/urls.py | 3 +- hosting/views.py | 13 ++-- 4 files changed, 67 insertions(+), 32 deletions(-) diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index d684bec7..49ebedd2 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-09-14 12:27+0000\n" +"POT-Creation-Date: 2017-09-21 19:20+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -321,10 +321,14 @@ msgstr "Als gelesen markieren" msgid "All notifications" msgstr "Alle Benachrichtigungen" -msgid "Date" -msgstr "Datum" +#, python-format +msgid "%(page_header_text)s" +msgstr "" -msgid "Status:" +msgid "Invoice Date" +msgstr "Rechnung Datum" + +msgid "Status" msgstr "" msgid "Approved" @@ -333,10 +337,10 @@ msgstr "Akzeptiert" msgid "Declined" msgstr "Abgelehnt" -msgid "Billed To:" +msgid "Billed to" msgstr "Rechnungsadresse" -msgid "Payment Method:" +msgid "Payment method" msgstr "Bezahlmethode" msgid "ending in" @@ -345,6 +349,9 @@ msgstr "endend in" msgid "Order summary" msgstr "Bestellungsübersicht" +msgid "Product" +msgstr "" + msgid "Cores" msgstr "Prozessorkerne" @@ -357,20 +364,40 @@ msgstr "Festplattenkapazität" msgid "Total" msgstr "Gesamt" -msgid "Finish Configuration" -msgstr "Konfiguration beenden" +#, python-format +msgid "" +"By clicking \"Place order\" this plan will charge your credit card account " +"with the fee of %(vm_price)sCHF/month" +msgstr "" +"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price)sCHF " +"pro Monat belastet" + +msgid "Place order" +msgstr "Bestellen" + +msgid "BACK TO LIST" +msgstr "ZURÜCK ZUR LISTE" + +msgid "Processing..." +msgstr "Weiter..." + +msgid "Hold tight, we are processing your request" +msgstr "" + +msgid "Some problem encountered. Please try again later." +msgstr "" msgid "Order Nr." msgstr "Bestellung Nr." +msgid "Date" +msgstr "Datum" + msgid "Amount" msgstr "Betrag" -msgid "Status" -msgstr "" - msgid "See Invoice" -msgstr "Rechnung" +msgstr "Siehe Rechnung" msgid "Page" msgstr "" @@ -555,9 +582,6 @@ msgstr "Wir sind hier, um Dir zu helfen!" msgid "CONTACT" msgstr "KONTACT" -msgid "BACK TO LIST" -msgstr "ZURÜCK ZUR LISTE" - msgid "Terminate your Virtual Machine" msgstr "Deine Virtuelle Maschine beenden" @@ -618,13 +642,17 @@ msgstr "" msgid "Invalid credit card" msgstr "Ungültige Kreditkarte" -#, python-format -msgid "Your New VM %(vm_name)s at Data Center Light" -msgstr "Deine neue VM %(vm_name)s bei Data Center Light" - msgid "Confirm Order" msgstr "Bestellung Bestätigen" +msgid "Thank you for the order." +msgstr "Danke für den Auftrag" + +msgid "" +"Your VM will be up and running in a few moments. We will send you a " +"confirmation email as soon as it is ready." +msgstr "" + msgid "In order to create a VM, you need to create/upload your SSH KEY first." msgstr "" "Um eine VM zu erstellen musst du zuerst einen SSH-Key erstellen / hochladen." @@ -641,6 +669,12 @@ msgstr "VM Kündigung" msgid "VM %(VM_ID)s terminated successfully" msgstr "VM %(VM_ID)s erfolgreich beendet" +#~ msgid "Finish Configuration" +#~ msgstr "Konfiguration beenden" + +#~ msgid "Your New VM %(vm_name)s at Data Center Light" +#~ msgstr "Deine neue VM %(vm_name)s bei Data Center Light" + #~ msgid "My Virtual Machines" #~ msgstr "Meine virtuellen Maschinen" @@ -734,9 +768,6 @@ msgstr "VM %(VM_ID)s erfolgreich beendet" #~ msgid "Payment Details" #~ msgstr "Rechnungsdetails" -#~ msgid "Place Order" -#~ msgstr "Bestelle" - #~ msgid "CARD NUMBER" #~ msgstr "Kreditkartennummer" diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index c4cf5892..9466f396 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -79,7 +79,7 @@ {{order.last4}}
{{user.email}} {% else %} - {{cc_brand}} {% trans "ending in" %} **** + {{cc_brand|default:'Card'}} {% trans "ending in" %} **** {{cc_last4}}
{% if request.user.is_authenticated %} {{request.user.email}} @@ -105,7 +105,11 @@ {% endcomment %}

{% trans "Cores" %} - {{vm.cores|floatformat}} + {% if vm.cores %} + {{vm.cores|floatformat}} + {% else %} + {{vm.cpu|floatformat}} + {% endif %}

{% trans "Memory" %} diff --git a/hosting/urls.py b/hosting/urls.py index a946fee1..2868c717 100644 --- a/hosting/urls.py +++ b/hosting/urls.py @@ -9,10 +9,9 @@ from .views import ( HostingPricingView, CreateVirtualMachinesView, HostingBillListView, HostingBillDetailView, SSHKeyDeleteView, SSHKeyCreateView, SSHKeyListView, SSHKeyChoiceView, DashboardView, SettingsView) -from django.views.generic import TemplateView + urlpatterns = [ - url(r'test/?$', TemplateView.as_view(template_name='hosting/order_detail.html'), name='test'), url(r'index/?$', IndexView.as_view(), name='index'), url(r'django/?$', DjangoHostingView.as_view(), name='djangohosting'), url(r'dashboard/?$', DashboardView.as_view(), name='dashboard'), diff --git a/hosting/views.py b/hosting/views.py index 95304212..2f31442a 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -704,12 +704,13 @@ class OrdersHostingDetailView(LoginRequiredMixin, return context def get(self, request, *args, **kwargs): - if 'specs' not in self.request.session: - return HttpResponseRedirect( - reverse('hosting:create_virtual_machine') - ) - if 'token' not in self.request.session: - return HttpResponseRedirect(reverse('hosting:payment')) + if not self.kwargs.get('pk'): + if 'specs' not in self.request.session: + return HttpResponseRedirect( + reverse('hosting:create_virtual_machine') + ) + if 'token' not in self.request.session: + return HttpResponseRedirect(reverse('hosting:payment')) self.object = self.get_object() context = self.get_context_data(object=self.object) if 'failed_payment' in context: