You're welcome, Omar. It sounds like you beat me to the punch with inclusion tags! I can't provide an "official" answer on the topic, but I do this very practice on all of my projects. As long as the logic is contained within the appropriate app, I have no problem importing a templatetag at that layer in the cycle.
I don't know of another way to accomplish the goal, but if you learn of one be sure and let me know!
Cheers,
Jonathan
On 12/27/2012 01:43 AM, Omar Abou Mrad wrote:
I don't know of another way to accomplish the goal, but if you learn of one be sure and let me know!
Cheers,
Jonathan
On 12/27/2012 01:43 AM, Omar Abou Mrad wrote:
--On Wed, Dec 26, 2012 at 6:07 PM, Jonathan <jonathandavidbaker@gmail.com> wrote:
I think you've got the right idea with regard to structure and separation of concerns, and my next step would be to write 'recent polls' as an inclusion tag so that it can be reused on various templates that aren't necessarily directly concerned with the polls app. This allows you to maintain the integrity of your 'core' app views while still utilizing data from neighbouring apps, as you've described.
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags
Thank you Jonathan, I did consider the use of an inclusion tag, but the inclusion tag's code lies within the poll app and is being referenced/used by the 'core' app's templates. Is it acceptable to do such a thing when it comes to templates?
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment