diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 20f81cd9..b4623922 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -80,9 +80,8 @@ def blog(request): def blog_detail(request, slug): # post = Post.objects.filter_by_language(get_language()).filter(slug=slug).first() - language = 'en-us' # currently nothing is translated to german so we give then en - post = Post.objects.translated(language, slug=slug).first() + post = Post.objects.translated(get_language(), slug=slug).first() context = { 'post': post, } diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 7ab11944..85a380a3 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -137,7 +137,8 @@ TEMPLATES = [ os.path.join(PROJECT_DIR, 'hosting/templates/'), os.path.join(PROJECT_DIR, 'ungleich/templates/djangocms_blog/'), os.path.join(PROJECT_DIR, 'ungleich/templates/cms/ungleichch'), - os.path.join(PROJECT_DIR, 'ungleich/templates/ungleich') + os.path.join(PROJECT_DIR, 'ungleich/templates/ungleich'), + os.path.join(PROJECT_DIR, 'ungleich_page/templates/ungleich_page') ], 'APP_DIRS': True, diff --git a/dynamicweb/urls.py b/dynamicweb/urls.py index a732934e..f0fc25bb 100644 --- a/dynamicweb/urls.py +++ b/dynamicweb/urls.py @@ -7,9 +7,10 @@ from django.conf.urls.static import static from django.conf import settings from hosting.views import RailsHostingView, DjangoHostingView, NodeJSHostingView from membership import urls as membership_urls +from ungleich_page.views import LandingView import debug_toolbar -urlpatterns = [ +urlpatterns = [ url(r'^index.html$', LandingView.as_view()), url(r'^hosting/', include('hosting.urls', namespace="hosting")), url(r'^railshosting/', RailsHostingView.as_view(), name="rails.hosting"), url(r'^nodehosting/', NodeJSHostingView.as_view(), name="node.hosting"), @@ -21,12 +22,13 @@ urlpatterns = [ # note the django CMS URLs included via i18n_patterns urlpatterns += i18n_patterns('', + url(r'^/?$', LandingView.as_view()), url(r'^admin/', include(admin.site.urls)), url(r'^digitalglarus/login/', include(membership_urls)), url(r'^digitalglarus/', include('digitalglarus.urls', namespace="digitalglarus")), - # url(r'^blog/', include('ungleich.urls', namespace='ungleich')), - url(r'^ungleich_page/', + #url(r'^blog/', include('ungleich.urls', namespace='ungleich')), + url(r'^', include('ungleich_page.urls', namespace='ungleich_page'), name='ungleich_page'), url(r'^blog/', include('ungleich.urls', namespace='ungleich')), diff --git a/hosting/forms.py b/hosting/forms.py index 8007b2f4..2a4d67e3 100644 --- a/hosting/forms.py +++ b/hosting/forms.py @@ -21,6 +21,9 @@ class HostingOrderAdminForm(forms.ModelForm): raise forms.ValidationError("""You can't make a charge over a canceled virtual machine plan""") + if not customer: + raise forms.ValidationError("""You need select a costumer""") + # Make a charge to the customer stripe_utils = StripeUtils() charge_response = stripe_utils.make_charge(customer=customer.stripe_id, diff --git a/hosting/mixins.py b/hosting/mixins.py index e8a2b7b4..2f8de3a5 100644 --- a/hosting/mixins.py +++ b/hosting/mixins.py @@ -1,18 +1,21 @@ from django.shortcuts import redirect from django.core.urlresolvers import reverse +from .models import VirtualMachinePlan class ProcessVMSelectionMixin(object): def post(self, request, *args, **kwargs): + hosting = request.POST.get('configuration') + configuration_detail = dict(VirtualMachinePlan.VM_CONFIGURATION).get(hosting) vm_specs = { 'cores': request.POST.get('cores'), 'memory': request.POST.get('memory'), 'disk_size': request.POST.get('disk_space'), 'hosting_company': request.POST.get('hosting_company'), 'location_code': request.POST.get('location_code'), - 'configuration': request.POST.get('configuration'), - 'configuration_detail': request.POST.get('configuration_detail'), + 'configuration': hosting, + 'configuration_detail': configuration_detail, 'final_price': request.POST.get('final_price') } request.session['vm_specs'] = vm_specs diff --git a/hosting/models.py b/hosting/models.py index c8980aa9..7ce64696 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -5,6 +5,7 @@ from django.utils.translation import ugettext_lazy as _ from django.utils.functional import cached_property + from Crypto.PublicKey import RSA from stored_messages.settings import stored_messages_settings @@ -172,7 +173,7 @@ class VirtualMachinePlan(AssignPermissionsMixin, models.Model): private_key, public_key = self.generate_RSA() self.public_key = public_key self.save(update_fields=['public_key']) - return private_key + return private_key, public_key def cancel_plan(self): self.status = self.CANCELED_STATUS diff --git a/hosting/templates/emails/vm_status_changed.html b/hosting/templates/emails/vm_status_changed.html index 691c42a3..c60ba661 100644 --- a/hosting/templates/emails/vm_status_changed.html +++ b/hosting/templates/emails/vm_status_changed.html @@ -1,4 +1,3 @@ - {% load static from staticfiles %} diff --git a/hosting/templates/emails/vm_status_changed.txt b/hosting/templates/emails/vm_status_changed.txt index 691c42a3..c60ba661 100644 --- a/hosting/templates/emails/vm_status_changed.txt +++ b/hosting/templates/emails/vm_status_changed.txt @@ -1,4 +1,3 @@ - {% load static from staticfiles %} diff --git a/hosting/templates/hosting/hosting_pricing.html b/hosting/templates/hosting/hosting_pricing.html new file mode 100644 index 00000000..c6ae33d0 --- /dev/null +++ b/hosting/templates/hosting/hosting_pricing.html @@ -0,0 +1,44 @@ +{% load staticfiles %} + + + + + Hosting + + + + + + + + + + + + + + + + + + + {% include "hosting/includes/_pricing.html" with select_configuration=True%} + + + + {% if vm_types %} + + {%endif%} + + + + + + + + + + + \ No newline at end of file diff --git a/hosting/templates/hosting/includes/_pricing.html b/hosting/templates/hosting/includes/_pricing.html index 3a9138b4..92033be8 100644 --- a/hosting/templates/hosting/includes/_pricing.html +++ b/hosting/templates/hosting/includes/_pricing.html @@ -24,8 +24,7 @@ {% csrf_token %} - - +