{"issue":{"created_at":"2011-12-10T16:12:47Z","state":"open","updated_at":"2011-12-10T16:12:47Z","comments":0,"user":{"gravatar_id":"88dfdda5b8999b3db6397946fe42d644","id":423354,"url":"https://api.github.com/users/i-trofimtschuk","avatar_url":"https://secure.gravatar.com/avatar/88dfdda5b8999b3db6397946fe42d644?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"i-trofimtschuk"},"body":"This is more an Idea for an improvement than an Issue/Bug.\r\n\r\nFor some content types (section for example) it would be nice to use different templates depending on the region the content type is contained in.\r\nFor now you can only restrict a whole content type to a region, not the some special TYPE_CHOICES of it:\r\n\r\n    Page.create_content_type(SectionContent, cleanse=True,\r\n        TYPE_CHOICES=(\r\n            (u'big_pic', _(u'For Main')),\r\n            (u'small_pic', _(u'For Sidebar')),\r\n        ),\r\n        regions=('sidebar_region','main_region',))\r\n\r\nThis has the disadvantage, that if the user chooses the \"wrong\" one it could crash the design of the page.\r\n\r\nI see two possible solutions:\r\n\r\nThe first is: Extending TYPE_CHOICES like this:\r\n\r\n      Page.create_content_type(SectionContent, cleanse=True,\r\n          TYPE_CHOICES=(\r\n              (u'main', _(u'Main'), ('main_region',)),\r\n              (u'sidebar', _(u'Sidebar'), ('sidebar_region',)),\r\n          ))\r\nThis would allow ro register some types for some regions only\r\n=> Disadvantage: API-Changes\r\n\r\nThe other solution could be a convention for the templates like it is done in mediafile/section using the type. For example the section content types render method could be changed from\r\n\r\n    def render(self, **kwargs):\r\n        if self.mediafile:\r\n            mediafile_type = self.mediafile.type\r\n        else:\r\n            mediafile_type = 'nomedia'\r\n        return render_to_string([\r\n            'content/section/%s_%s.html' % (self.type, mediafile_type),\r\n            'content/section/%s.html' % self.type,\r\n            'content/section/%s.html' % mediafile_type,\r\n            'content/section/default.html',\r\n            ], {'content': self})\r\n\r\nto something like this:\r\n\r\n    def render(self, **kwargs):\r\n        if self.mediafile:\r\n            mediafile_type = self.mediafile.type\r\n        else:\r\n            mediafile_type = 'nomedia'\r\n        return render_to_string([\r\n            'content/section/%s__%s_%s.html' % (self.region, self.type, mediafile_type),\r\n            'content/section/%s_%s.html' % (self.type, mediafile_type),\r\n            'content/section/%s__%s.html' % (self.region, self.type),\r\n            'content/section/%s.html' % self.type,\r\n            'content/section/%s.html' % mediafile_type,\r\n            'content/section/default.html',\r\n            ], {'content': self})\r\n","assignee":null,"id":2511549,"number":235,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[],"title":"Make it possible to use different content templates for different regions","html_url":"https://github.com/feincms/feincms/issues/235","closed_at":null,"url":"https://api.github.com/repos/feincms/feincms/issues/235","milestone":null},"action":"opened"}