Add GlasfaserServicesPlugin and GlasfaserServicesItemPlugin
This commit is contained in:
		
					parent
					
						
							
								f3e4ede52e
							
						
					
				
			
			
				commit
				
					
						cfcc3e0eb1
					
				
			
		
					 1 changed files with 21 additions and 8 deletions
				
			
		|  | @ -2,8 +2,8 @@ from cms.plugin_base import CMSPluginBase | ||||||
| from cms.plugin_pool import plugin_pool | from cms.plugin_pool import plugin_pool | ||||||
| 
 | 
 | ||||||
| from .models import ( | from .models import ( | ||||||
|     UngelichPicture, UngelichContactUsSection, UngelichTextSection, |     UngelichPicture, UngelichContactUsSection, UngelichTextSection, Service, | ||||||
|     UngelichTextSectionWithImage |     ServiceItem | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -45,14 +45,27 @@ class SectionTextParagraphGlasfaser(CMSPluginBase): | ||||||
| 
 | 
 | ||||||
| @plugin_pool.register_plugin | @plugin_pool.register_plugin | ||||||
| class GlasfaserServicesPlugin(CMSPluginBase): | class GlasfaserServicesPlugin(CMSPluginBase): | ||||||
|     model = UngelichTextSectionWithImage |     name = "Glasfaser Services Plugin" | ||||||
|  |     model = Service | ||||||
|     render_template = "ungleich_page/glasfaser/section_services.html" |     render_template = "ungleich_page/glasfaser/section_services.html" | ||||||
|     cache = False |     cache = False | ||||||
|  |     allow_children = True | ||||||
|  |     child_classes = ['GlasfaserServicesItemPlugin'] | ||||||
| 
 | 
 | ||||||
|     def render(self, context, instance, placeholder): |     def render(self, context, instance, placeholder): | ||||||
|         context.update({ |         context['service_instance'] = instance | ||||||
|             'image': instance.image, |         return context | ||||||
|             'object': instance, | 
 | ||||||
|             'placeholder': placeholder | 
 | ||||||
|         }) | @plugin_pool.register_plugin | ||||||
|  | class GlasfaserServicesItemPlugin(CMSPluginBase): | ||||||
|  |     name = "Glasfaser Service Item Plugin" | ||||||
|  |     model = ServiceItem | ||||||
|  |     render_template = "ungleich_page/glasfaser/section_services_item.html" | ||||||
|  |     cache = False | ||||||
|  |     require_parent = True | ||||||
|  |     parent_classes = ['GlasfaserServicesPlugin'] | ||||||
|  | 
 | ||||||
|  |     def render(self, context, instance, placeholder): | ||||||
|  |         context['instance'] = instance | ||||||
|         return context |         return context | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue