On Thu, Feb 19, 2009 at 2:00 PM, christian.oud...@gmail.com < christian.oud...@gmail.com> wrote:
> > I have alot of pages using javascript, and a lot of forms that specify > javascript in the Meta.media class. I keep having problems duplicating > javascript includes. This happens when i include the form media with a > context variable (e.g. {{ media }} ), but the template also specifies > a <script src="..."> tag. > > One approach I considered was to never specify <script src=... > tags > in my templates, and only specify media in my views, and pass them to > the "media" context variable. This would work, but seems like an > improper separation of concerns, because the view shouldn't care about > what media the template gets, the template should. > > Is there a clean way to fix this problem? > > > My solution would be to create a templatetag that creats Media class instances for some set of js and css, then use a filter or a tag to combine all your media classes which will handle the filtering of duplicates automatically. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---