I seem to have solved my problem by putting the value into RequestContext from the view that calls the page /main/site/01/2011.
Is this the correct way to get request/url params into a custom/inclusion tag?
Inclusion Tag
from django import template
from hive.dashboard.models import MyModel
from datetime import date
register = template.Library()
@register.inclusion_tag('template.html',takes_context=True)
def my_tag(context):
param = context['my_param']
content = MyModel.objects.filter(id=param)
return {'content': content}
On Thu, Feb 3, 2011 at 7:53 PM, Cal Leeming [Simplicity Media Ltd] <cal.leeming@simplicitymedialtd.co.uk> wrote:
Sorry I don't quite understand what you mean, can you give a code example of what you are trying to do / wish for it to do?On Thu, Feb 3, 2011 at 9:41 PM, J <django@dangeometer.com> wrote:
Is there a way to access kwargs from a custom/inclusion tag?
--
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.
--
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.
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