def test_microsite_get_template(self): """ Test microsite.get_template return appropriate template. """ microsite.set_by_domain(self.microsite.site.domain) template = microsite.get_template('about.html') self.assertIn('About this microsite', template.render())
def test_microsite_get_template_when_no_template_exists(self): """ Test microsite.get_template return None if there is not template in DB. """ MicrositeTemplate.objects.all().delete() microsite.set_by_domain(self.microsite.site.domain) template = microsite.get_template('about.html') self.assertIsNone(template)
def get_template(uri): """ This is a proxy function to hide microsite_configuration behind comprehensive theming. :param uri: uri of the template """ # We need to give priority to theming over microsites # So, we apply microsite template override only when there is no associated theme, if not current_request_has_associated_site_theme(): return microsite.get_template(uri)
def get_template(self, uri): """ Overridden method which will hand-off the template lookup to the microsite subsystem """ microsite_template = microsite.get_template(uri) return ( microsite_template if microsite_template else super(DynamicTemplateLookup, self).get_template(uri) )
def get_template(uri): """ This is a proxy function to hide microsite_configuration behind comprehensive theming. :param uri: uri of the template """ return microsite.get_template(uri)