cms integration
This commit is contained in:
		
					parent
					
						
							
								251d4928e2
							
						
					
				
			
			
				commit
				
					
						bc36849178
					
				
			
		
					 6 changed files with 45 additions and 18 deletions
				
			
		
							
								
								
									
										10
									
								
								datacenterlight/admin.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								datacenterlight/admin.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,10 @@
 | 
				
			||||||
 | 
					from django.contrib import admin
 | 
				
			||||||
 | 
					from cms.admin.placeholderadmin import PlaceholderAdminMixin
 | 
				
			||||||
 | 
					from .cms_models import CMSIntegration
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class CMSIntegrationAdmin(PlaceholderAdminMixin, admin.ModelAdmin):
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					admin.site.register(CMSIntegration, CMSIntegrationAdmin)
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,17 @@ from django.db import models
 | 
				
			||||||
from django.utils.safestring import mark_safe
 | 
					from django.utils.safestring import mark_safe
 | 
				
			||||||
from djangocms_text_ckeditor.fields import HTMLField
 | 
					from djangocms_text_ckeditor.fields import HTMLField
 | 
				
			||||||
from filer.fields.image import FilerImageField
 | 
					from filer.fields.image import FilerImageField
 | 
				
			||||||
 | 
					from cms.models.fields import PlaceholderField
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class CMSIntegration(models.Model):
 | 
				
			||||||
 | 
					    name = models.CharField(
 | 
				
			||||||
 | 
					        max_length=100, unique=True, default='default',
 | 
				
			||||||
 | 
					        help_text='An optional heading for the Section',
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    footer_placeholder = PlaceholderField('datacenterlight_footer')
 | 
				
			||||||
 | 
					    navbar_placeholder = PlaceholderField('datacenterlight_navbar')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Models for CMS Plugins
 | 
					# Models for CMS Plugins
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
body,
 | 
					body,
 | 
				
			||||||
html {
 | 
					html {
 | 
				
			||||||
  width: 100%;
 | 
					  width: 100%;
 | 
				
			||||||
  min-height: 100%;
 | 
					  height: 100%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
body,
 | 
					body,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
{% load staticfiles i18n %}
 | 
					{% load staticfiles i18n cms_tags sekizai_tags %}
 | 
				
			||||||
{% get_current_language as LANGUAGE_CODE %}
 | 
					{% get_current_language as LANGUAGE_CODE %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,9 @@
 | 
				
			||||||
    {% block css_extra %}
 | 
					    {% block css_extra %}
 | 
				
			||||||
    {% endblock css_extra %}
 | 
					    {% endblock css_extra %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %}
 | 
				
			||||||
 | 
					    {% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- External Fonts -->
 | 
					    <!-- External Fonts -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <link rel="shortcut icon" href="{% static 'datacenterlight/img/favicon.ico' %}" type="image/x-icon">
 | 
					    <link rel="shortcut icon" href="{% static 'datacenterlight/img/favicon.ico' %}" type="image/x-icon">
 | 
				
			||||||
| 
						 | 
					@ -43,10 +46,9 @@
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
 | 
					    {% cms_toolbar %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    {% block navbar %}
 | 
					    {% render_placeholder cms_integration.navbar_placeholder %}
 | 
				
			||||||
        {% include "hosting/includes/_navbar_user.html" %}
 | 
					 | 
				
			||||||
    {% endblock navbar %}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div class="{% if request.user.is_authenticated %}content-dashboard{% endif %}">
 | 
					    <div class="{% if request.user.is_authenticated %}content-dashboard{% endif %}">
 | 
				
			||||||
        {% block content %}
 | 
					        {% block content %}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
{% extends "datacenterlight/base_hosting.html" %}
 | 
					{% extends "datacenterlight/base_hosting.html" %}
 | 
				
			||||||
{% load staticfiles bootstrap3 i18n %}
 | 
					{% load staticfiles bootstrap3 i18n cms_tags %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block css_extra %}
 | 
					{% block css_extra %}
 | 
				
			||||||
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paymentfont/1.1.2/css/paymentfont.min.css"/>
 | 
					    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paymentfont/1.1.2/css/paymentfont.min.css"/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,14 +18,13 @@ from hosting.forms import HostingUserLoginForm
 | 
				
			||||||
from hosting.models import HostingOrder
 | 
					from hosting.models import HostingOrder
 | 
				
			||||||
from membership.models import CustomUser, StripeCustomer
 | 
					from membership.models import CustomUser, StripeCustomer
 | 
				
			||||||
from opennebula_api.serializers import VMTemplateSerializer
 | 
					from opennebula_api.serializers import VMTemplateSerializer
 | 
				
			||||||
from utils.forms import (
 | 
					from utils.forms import BillingAddressForm, BillingAddressFormSignup
 | 
				
			||||||
    BillingAddressForm, BillingAddressFormSignup
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
from utils.hosting_utils import get_vm_price
 | 
					from utils.hosting_utils import get_vm_price
 | 
				
			||||||
from utils.stripe_utils import StripeUtils
 | 
					from utils.stripe_utils import StripeUtils
 | 
				
			||||||
from utils.tasks import send_plain_email_task
 | 
					from utils.tasks import send_plain_email_task
 | 
				
			||||||
from .forms import ContactForm
 | 
					from .forms import ContactForm
 | 
				
			||||||
from .models import VMTemplate
 | 
					from .models import VMTemplate
 | 
				
			||||||
 | 
					from .cms_models import CMSIntegration
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logger = logging.getLogger(__name__)
 | 
					logger = logging.getLogger(__name__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,9 +41,10 @@ class ContactUsView(FormView):
 | 
				
			||||||
            return self.render_to_response(
 | 
					            return self.render_to_response(
 | 
				
			||||||
                self.get_context_data(contact_form=form))
 | 
					                self.get_context_data(contact_form=form))
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            return render(self.request,
 | 
					            return render(
 | 
				
			||||||
                          'datacenterlight/index.html',
 | 
					                self.request, 'datacenterlight/index.html',
 | 
				
			||||||
                          self.get_context_data(contact_form=form))
 | 
					                self.get_context_data(contact_form=form)
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def form_valid(self, form):
 | 
					    def form_valid(self, form):
 | 
				
			||||||
        form.save()
 | 
					        form.save()
 | 
				
			||||||
| 
						 | 
					@ -68,10 +68,10 @@ class ContactUsView(FormView):
 | 
				
			||||||
            return self.render_to_response(
 | 
					            return self.render_to_response(
 | 
				
			||||||
                self.get_context_data(success=True, contact_form=form))
 | 
					                self.get_context_data(success=True, contact_form=form))
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            return render(self.request,
 | 
					            return render(
 | 
				
			||||||
                          'datacenterlight/index.html',
 | 
					                self.request, 'datacenterlight/index.html',
 | 
				
			||||||
                          self.get_context_data(success=True,
 | 
					                self.get_context_data(success=True, contact_form=form)
 | 
				
			||||||
                                                contact_form=form))
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class IndexView(CreateView):
 | 
					class IndexView(CreateView):
 | 
				
			||||||
| 
						 | 
					@ -219,7 +219,8 @@ class PaymentOrderView(FormView):
 | 
				
			||||||
            'stripe_key': settings.STRIPE_API_PUBLIC_KEY,
 | 
					            'stripe_key': settings.STRIPE_API_PUBLIC_KEY,
 | 
				
			||||||
            'site_url': reverse('datacenterlight:index'),
 | 
					            'site_url': reverse('datacenterlight:index'),
 | 
				
			||||||
            'login_form': HostingUserLoginForm(prefix='login_form'),
 | 
					            'login_form': HostingUserLoginForm(prefix='login_form'),
 | 
				
			||||||
            'billing_address_form': billing_address_form
 | 
					            'billing_address_form': billing_address_form,
 | 
				
			||||||
 | 
					            'cms_integration': CMSIntegration.objects.get(name='default')
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        return context
 | 
					        return context
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -354,7 +355,10 @@ class OrderConfirmationView(DetailView):
 | 
				
			||||||
            'cc_brand': card_details.get('response_object').get('brand'),
 | 
					            'cc_brand': card_details.get('response_object').get('brand'),
 | 
				
			||||||
            'vm': request.session.get('specs'),
 | 
					            'vm': request.session.get('specs'),
 | 
				
			||||||
            'page_header_text': _('Confirm Order'),
 | 
					            'page_header_text': _('Confirm Order'),
 | 
				
			||||||
            'billing_address_data': request.session.get('billing_address_data')
 | 
					            'billing_address_data': (
 | 
				
			||||||
 | 
					                request.session.get('billing_address_data')
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
 | 
					            'cms_integration': CMSIntegration.objects.get(name='default')
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return render(request, self.template_name, context)
 | 
					        return render(request, self.template_name, context)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue