templatetags

Import Error when use templatetags in Django

Well, when I'm trying to use 'inclusion' in Django, I met some confused problems that I can't solve it by myself. There is the structures for my project. MyProject--- App1--- __init__.py models.py test.py urls.py views.py ...

Django Thread-Safety for templatetags

Hi, I am coming here, because I have a question about Django and Thread. I read the documentation http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#template-tag-thread-safety and I would like to now if the next code could be impacted also, at the rendering context. class ChatterCountNode(NodeBase): def __init__(self,...

how can we set safe template tag for admin change_form.html

how can we set safe template tag for admin change_form.html, I want to display HTML data instead of TextArea Input for admin form, I've a django field which is excluded in admin form, that field contains HTML data - which is dynamically generated - u can say reporting data, I want to display that HTML data with safe templatetag below t...

Django: how to pass form variable to simple tag in template

Hello. I am trying to do some custom things in Django comments form. I have simple tag named "get_flatpage_by_id" that returns flatpage model data as array. This is working I expected: {% get_flatpage_by_id 14 as page %} It's returning flatpage that ID is 14. But this is not working, if I try to pass {{ form.object_pk.data }} (that ret...

Can I raise Http404 in a Django template tag?

I have a Django application that provides template tag profile. The tag accepts a username as its argument. How should I treat the situation when there exists no User instance with the given username? Does it make sense to raise HTTP 404 inside a template tag? Or should I simply pass an empty dictionary to the template? ...

loading and unloading external video in mc

on button press one time load external movie on MC and when first movie ends the next movies should play. help me ...

How do I access unrelated models within a Django template?

I want to use an app to create a menu that is easy to edit with the admin interface. Something like this: class Menu_item name = models.CharField() item_url = models.URLField() My template looks something like this: {% extends base.html %} div ID="nav" {{ foo.navbar.? }} /div div ID="Content" ...

Re-usable HTML code / widgets

Sometimes I need to use the same html code in different templates, like: <div class="mylist"><span>item-1</span><span>item-2</span>...</div> or more complicated widgets. I'm new to Django so I want to learn what do you usually do in these kinds of situations? Do you create your own template tags or what? ...

Get full path of text file or any file in c#

Respected Sir, my Question is that when I am Opening my txt file i.e abc.txt so I want to get full path of only running or opening file in my computer I have done this Process prs=Process.GetProcessByName("notepad"); foreach(Process p in prs) { p.Modules[0].FileName.ToString(); } Which is giving me Notepad.exe path. I...

datagridview tab first cell to third cell

hello, i have a datagridview in c#. when i use tab then focus show on direct first cell to third cell don't go on second cell on datagridview. leave the second cell. please give me any solution. ...

Returning an inclusion tag

Hi, I am suffering whereever i try to do something in django that is not common(in django, not in python in general) For example, i don't know how to return an inclusion tag. This. obviously, won't work: @register.inclusion_tag('template.tpl') def myinclusiontag(parameter): return {'var': parameter.attr1} @register.inclusion_tag(...

How do I write a Django template tag for access control?

I'm trying, in vain, to create a simple Django template tag to either show or hide a "delete" link next to a submitted comment on my site. In a nutshell, I want to pass the comment object to the template tag, determine if the currently logged in user is authorized to delete the comment and then either show or not show the link. The usa...

Django, extending admin's templatetags

I want to add an templatetag to the django admin, how can I go around extending the existing tags without needing to fudge in django.contrib.admin.templatetags? Update: Using {% load mytemplatetags %} in the admin templates breaks my server for some reason (im using nginx and throws me a bad gateway for that page). But the file mytempl...

Mako templates using Django template tags

Our Django site is built using Mako templates. We want to use a third party project called django-socialregistration, but its template tags use Django's templates. If we used Django templates we could just {% load facebook_tags %} {% facebook_button %} {% facebook_js %} How can I do the same thing in Mako? You can inline strait up py...

getting values for properties files inside a jar file

I have .properties file inside a jar for values I have place holder like $value I need to put the value for the place holder taking the value from a file placed outside the jar. both are in classpath ...