Re: Custom template tags - instance.templatetag

2020-06-09 Thread The Sha
Den tisdag 2 juni 2020 kl. 22:53:06 UTC+2 skrev Jan Gregorczyk: > > Hi! How to change my template tag? > from django import template > > register = template.Library() > > @register.simple_tag > def votes_up_exists(answer, user_id): > pass > > how I use it - {% votes_up_exists answer

Re: Custom template tags - instance.templatetag

2020-06-03 Thread Andréas Kühne
Sorry - I posted that without a link? https://stackoverflow.com/questions/1333189/django-template-system-calling-a-function-inside-a-model This is by design - and you should always try to simplify what you are doing in django templates. Regards, Andréas Den ons 3 juni 2020 kl 11:41 skrev

Re: Custom template tags - instance.templatetag

2020-06-03 Thread Andréas Kühne
Hi Jan, You can't do it like that. A templatetag is a simple function that is handled in a special way by the django templating language. See here for an explanation: Med vänliga hälsningar, Andréas Den tis 2 juni 2020 kl 22:53 skrev Jan Gregorczyk : > Hi! How to change my template tag? >

Custom template tags - instance.templatetag

2020-06-02 Thread Jan Gregorczyk
Hi! How to change my template tag? from django import template register = template.Library() @register.simple_tag def votes_up_exists(answer, user_id): pass how I use it - {% votes_up_exists answer request.user.id %} how I would like to use it - {% answer.votes_up_exists user_id %} -- You

Re: Custom Template Tags Render Method

2019-11-24 Thread 'Ross' via Django users
I meant to write "indeed this section of the same article seems to support this - https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#auto-escaping-considerations " On Sunday, November 24, 2019 at 6:43:44 PM UTC, Ross wrote: > > To create our own custom templ

Custom Template Tags Render Method

2019-11-24 Thread 'Ross' via Django users
To create our own custom template tags we have to define a Node subclass which implements a render method. Example from https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#auto-escaping-considerations import datetimefrom django import template class CurrentTimeNode(template.Node

Re: Nesting custom template tags

2014-04-01 Thread Kelvin Wong
You might want to look at the code for making a tag like: URLNode(Node) line 408 of https://github.com/django/django/blob/stable/1.6.x/django/template/defaulttags.py Then extend that. class MyAnchor(URLNode): override the init function to accept the params your are sending and override

Nesting custom template tags

2014-03-29 Thread Jon Dufresne
Hi, I am trying to create a custom template tag that generates a repetitive HTML snippet. This tag is an anchor tag "a" with extra classes and styles, plus some logic to apply additional classes and styles. I want the syntax in the template to look something like: {% my_anchor URL %}this is

Re: Defining custom template tags in a new app

2013-08-20 Thread Tom Evans
On Tue, Aug 20, 2013 at 1:54 PM, Daniel Roseman wrote: > Django doesn't care what app the tags are in, as long as that app is in > INSTALLED_APPS and the tags are in the templatetags directory inside the app > (and Python requires a blank __init__.py in that directory too).

Re: Defining custom template tags in a new app

2013-08-20 Thread Tom Lockhart
On 2013-08-20, at 3:53 AM, kandelabr <kandel...@gmail.com> wrote: > Hello! > > I want to define a new template tag and use it in a number of applications > inside my django project. The documentation says: > > Custom template tags and filters must live inside a Djang

Re: Defining custom template tags in a new app

2013-08-20 Thread Daniel Roseman
On Tuesday, 20 August 2013 11:53:27 UTC+1, kandelabr wrote: > Hello! > > I want to define a new template tag and use it in a number of applications > inside my django project. The documentation says: > > *Custom template tags and filters must live inside a Django app.

Defining custom template tags in a new app

2013-08-20 Thread kandelabr
Hello! I want to define a new template tag and use it in a number of applications inside my django project. The documentation says: *Custom template tags and filters must live inside a Django app. If they relate to an existing app it makes sense to bundle them there; otherwise, you should

How create custom template tags and use Forms?

2013-06-28 Thread MacVictor
I create custom django template and used Form (this tag has to be universal): This is file ratings.py use tags: from django import template from django.contrib.contenttypes.models import ContentType from Ratings.forms import RatingsForm register = template.Library() class

Re: Parse Custom html in custom template tags, django 1.4

2012-04-30 Thread 95felipe
Hi! But then the rendering wouldn't include the loaded templatetags. And I guess it would be expensive to go through this process a couple times for each call of the renderer. On Monday, 30 April 2012 09:24:54 UTC-3, Daniel Roseman wrote: > > > > On Monday, 30 April 2012 09:03:56 UTC+1, 95felipe

Re: Parse Custom html in custom template tags, django 1.4

2012-04-30 Thread Daniel Roseman
On Monday, 30 April 2012 09:03:56 UTC+1, 95felipe wrote: > > Hi. I've been struggling with this problem the whole night and just > couldn't find any solution. I've tried reverse engineering the > template/base.py file, but things are getting ugly. :S > > How can I, inside a custom tag class

Parse Custom html in custom template tags, django 1.4

2012-04-30 Thread 95felipe
Hi. I've been struggling with this problem the whole night and just couldn't find any solution. I've tried reverse engineering the template/base.py file, but things are getting ugly. :S How can I, inside a custom tag class (template.Node), make the parser render a snippet of html with tags

Re: Constant name error undefined in custom template tags

2011-10-10 Thread Kayode Odeyemi
On Sun, Oct 9, 2011 at 8:49 PM, Daniel Roseman wrote: > On Sunday, 9 October 2011 20:26:26 UTC+1, Kayode Odeyemi wrote: > >> Hello, >> >> I'm creating a template tag that will will allow session variables stored >> as strings or >> dict in a view to be available in its

Re: Constant name error undefined in custom template tags

2011-10-09 Thread Daniel Roseman
On Sunday, 9 October 2011 20:26:26 UTC+1, Kayode Odeyemi wrote: > > Hello, > > I'm creating a template tag that will will allow session variables stored > as strings or > dict in a view to be available in its template. The syntax is: > > {% session_value [view_name] [session_variable] [arg] %}

Constant name error undefined in custom template tags

2011-10-09 Thread Kayode Odeyemi
Hello, I'm creating a template tag that will will allow session variables stored as strings or dict in a view to be available in its template. The syntax is: {% session_value [view_name] [session_variable] [arg] %} But at the moment I don't know how I can get Django to stop throwing name errors

Re: django custom template tags: how to send to (parser, token)

2011-03-30 Thread bruno desthuilliers
On 30 mar, 21:55, justin jools wrote: > I've just started using custom tags and need some help parsing info > to: > > @register.tag > def friends_of(parser, token): >     tag_name, user_var = token.split_contents() Don't assume you'll only have what you expected here.

django custom template tags: how to send to (parser, token)

2011-03-30 Thread justin jools
I've just started using custom tags and need some help parsing info to: @register.tag def friends_of(parser, token): tag_name, user_var = token.split_contents() return FriendsOfNode(user_var) class FriendsOfNode(template.Node): def __init__(self, user_var): self.user_var =

Django: How to get field value dynamically using custom template tags?

2010-11-02 Thread Duy
I recently got a problem where I need to get field's value automatically using templatetags.The idea follows which mentioned in the book "Practical Django Project 2nd Edition", but the book version is getting a list of objects where I want to get only a object's value. I want to get the site

Re: custom template tags with a raw query

2010-06-16 Thread Cole743
The first link I had seen and used. My custom query works, I had just been having issues with the tags. I had been through the docs and seen a different one on tags, but apparently passed over the one you posted in the link. It filled in some of the gaps I was missing, thanks. Very helpful. --

Re: custom template tags with a raw query

2010-06-15 Thread Vasil Vangelovski
To use custom SQL see this for reference: http://docs.djangoproject.com/en/dev/topics/db/sql/ To create a templatetag see this for reference: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ On Mon, Jun 14, 2010 at 10:08 PM, Cole743 <cole.rieger...@gmail.com> wrote: &

custom template tags with a raw query

2010-06-14 Thread Cole743
Hello again, My last question may have been unclear, so I'm going to be more specific. I want to use the results of this: cursor.execute("SELECT * from sp_getreport(""varchar"" %s)", [usr]) (or something similar) In a custom template tag to display in a template. The results of the query are: a

Re: custom template tags used in an included template

2010-02-17 Thread Joel Stransky
Good to know. Thanks. On Wed, Feb 17, 2010 at 3:44 AM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On Feb 16, 10:57 pm, Joel Stransky wrote: > > The problem is that if I load the tag inside base via {% load > my_custom_tag > > %} it breaks but if I

Re: custom template tags used in an included template

2010-02-17 Thread bruno desthuilliers
On Feb 16, 10:57 pm, Joel Stransky wrote: > The problem is that if I load the tag inside base via {% load my_custom_tag > %} it breaks but if I include that line inside mainContent, it works. My > goal here was to load all custom tags in the base so that I'd never have to

Re: custom template tags used in an included template

2010-02-16 Thread Joel Stransky
Sorry, I meant custom filters, myModel.image|my_media_path On Tue, Feb 16, 2010 at 4:57 PM, Joel Stransky wrote: > I have a base.html template which includes a mainContent.html template. > mainContent reads a relative image path from the model passed to it but has > a

custom template tags used in an included template

2010-02-16 Thread Joel Stransky
I have a base.html template which includes a mainContent.html template. mainContent reads a relative image path from the model passed to it but has a custom template tag used for locating the start of the path which makes it easy to develop locally and deploy the project without having to change

Re: Custom template tags

2009-09-09 Thread Daniel Roseman
On Sep 9, 4:00 pm, tdelam wrote: > Hey, > > I would like to know if I should write a custom template tag or if > anyone can give me some direction on how to do the following: > > 1) User visits a page on a web site, example.org/campaign/businessname > 2) I capture

Custom template tags

2009-09-09 Thread tdelam
Hey, I would like to know if I should write a custom template tag or if anyone can give me some direction on how to do the following: 1) User visits a page on a web site, example.org/campaign/businessname 2) I capture "businessname" and fetch the details of that user from the database and

Re: custom template tags and template loaders

2009-07-30 Thread Daymien
Hi guys, I got the solution for me. Read here: http://groups.google.com/group/django-users/browse_thread/thread/7b7dad85530eceed/63be3eb5e41ce9f0#63be3eb5e41ce9f0 regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: custom template tags and template loaders

2009-07-30 Thread chefsmart
Daymien has a similar issue at http://groups.google.com/group/django-users/t/7b7dad85530eceed Just wanted to link the two discussions. On Jul 30, 12:11 pm, chefsmart wrote: > There is absolutely no difference between my dev and production, only > the database details

Re: custom template tags and template loaders

2009-07-30 Thread chefsmart
There is absolutely no difference between my dev and production, only the database details in the settings.py are different. The 'django.template.loaders.app_directories.load_template_source' is not included in both my dev as well as my production setups (which is in testing phase now). So

Re: custom template tags and template loaders

2009-07-29 Thread krylatij
And do you want to avoid 'django.template.loaders.app_directories.load_template_source' ? It will work only when your template will not be found in default template directory So i guess there is no overhead when you use it in production. May be you have DEBUG=True in your development version

Re: custom template tags and template loaders

2009-07-29 Thread chefsmart
I got no other custom tags. This is pretty confusing. It works perfectly on the django dev server with no code changes. Don't really know enough about the pre-requisites (settings.py, etc) for using custom templatetags, so haven't progressed much in my troubleshooting. On Jul 29, 9:24 pm,

Re: custom template tags and template loaders

2009-07-29 Thread krylatij
And what about other custom tags? I actually have no more ideas, what it can be. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: custom template tags and template loaders

2009-07-29 Thread chefsmart
I get the following message. Please note that everything is ok in my development setup, but the same thing doesn't work in my production setup. TemplateSyntaxError at /staff/ 'smart_if' is not a valid tag library: Could not load template library from django.templatetags.smart_if, No module

Re: custom template tags and template loaders

2009-07-29 Thread krylatij
I my case custom tags are still working after i removed ''django.template.loaders.app_directories.load_template_source'' from settings. You can see comment in site-packages\django\template\loaders \app_directories.py: """ Wrapper for loading templates from "templates" directories in

Re: custom template tags and template loaders

2009-07-29 Thread chefsmart
plates' ). > > On Jul 28, 11:23 pm, chefsmart <moran.cors...@gmail.com> wrote: > > > Is 'django.template.loaders.app_directories.load_template_source' > > required in the TEMPLATE_LOADERS setting for custom template tags to > > work? --~--~-~--~~-

Re: custom template tags and template loaders

2009-07-29 Thread krylatij
com> wrote: > Is 'django.template.loaders.app_directories.load_template_source' > required in the TEMPLATE_LOADERS setting for custom template tags to > work? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

custom template tags and template loaders

2009-07-28 Thread chefsmart
Is 'django.template.loaders.app_directories.load_template_source' required in the TEMPLATE_LOADERS setting for custom template tags to work? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&q

Re: Doctests for custom template tags

2009-07-18 Thread A Khodyrev
ctions to ease creation of > custom template tags. So a natural doctest (or an example in the > documentation) goes like this: define a compiler function and Node > class with my helpers, register them with a tag library, define a > bunch of template strings with these tags, then render

Re: Custom template tags in admin with hacking to source?

2009-02-16 Thread Karen Tracey
On Mon, Feb 16, 2009 at 11:49 AM, Daniel Roseman < roseman.dan...@googlemail.com> wrote: > > On Feb 16, 4:23 pm, Ben Gerdemann wrote: > > Is it possible to add a custom template tag to the admin without > > modifying the Django source? I'd like to add a tag to display a > >

Re: Custom template tags in admin with hacking to source?

2009-02-16 Thread Daniel Roseman
On Feb 16, 4:23 pm, Ben Gerdemann wrote: > Is it possible to add a custom template tag to the admin without > modifying the Django source? I'd like to add a tag to display a > different submit_line, but the only way I can figure out how to do > this is by either adding one of

Re: custom template tags

2008-07-03 Thread mccomas . chris
here's the code: TEMPLATE {% load more_news %} {% get_morenews_list %} {% for news in more_news %} {{ news.title }} {% endfor %} MORE_NEWS.PY from myproject.site.models import Blog from django.template import Library,Node register = Library() def build_morenews_list(parser, token):

Re: custom template tags

2008-07-03 Thread mccomas . chris
one more thing. the first one is working. i tried to setup a second template tag for the page called more_news.py. the first is working as recent_news.py. recent_news.py gets the more recent entry, i have more_news.py set to get 2-6. i have {% load more_news %} since the file is more_news.py,

Re: custom template tags

2008-07-03 Thread mccomas . chris
thanks man, for some reason i couldn't get it and it was about to drive me nuts :) On Jul 3, 10:37 am, Berco Beute <[EMAIL PROTECTED]> wrote: > It should be in: > /project/application/templatetags/ > > 2B --~--~-~--~~~---~--~~ You received this message because

Re: custom template tags

2008-07-03 Thread Malcolm Tredinnick
On Thu, 2008-07-03 at 07:33 -0700, [EMAIL PROTECTED] wrote: > On my homepage I want to have a few different items, one is the recent > news items. I created the recentnews.py file: > > from myproject.site.models import Blog > from django.template import Library,Node > > register = Library() >

Re: custom template tags

2008-07-03 Thread mccomas . chris
Didn't mean to send it. In my template I'm using this to call the recent news: {% load recent_news %} {% get_news_list %} I'm getting a TemplateSyntaxError, 'recent_news' is not a valid tag library: Could not load template library from django.templatetags.recent_news, No module named

Re: custom template tags

2008-07-03 Thread Berco Beute
It should be in: /project/application/templatetags/ 2B --~--~-~--~~~---~--~~ 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

custom template tags

2008-07-03 Thread mccomas . chris
On my homepage I want to have a few different items, one is the recent news items. I created the recentnews.py file: from myproject.site.models import Blog from django.template import Library,Node register = Library() def build_news_list(parser, token): return NewsObject() class

Re: confusion over custom template tags

2008-01-25 Thread Rajesh Dhawan
On Jan 24, 10:36 pm, hifire <[EMAIL PROTECTED]> wrote: > Greetings group! > > I've been trying to get this code to > work:http://www.djangosnippets.org/snippets/282/ > > I created a templatetags folder in my app, and added __init__.py and > usertags.py. I pasted the code from the snippets site

confusion over custom template tags

2008-01-24 Thread hifire
Greetings group! I've been trying to get this code to work: http://www.djangosnippets.org/snippets/282/ I created a templatetags folder in my app, and added __init__.py and usertags.py. I pasted the code from the snippets site into my usertags.py. I have a view define like this:

Re: Templates for Custom Template Tags

2007-09-30 Thread Steve Potter
I was misunderstanding where the app_directories loader looks for files. It makes sense now. Thanks, Steve On Sep 30, 3:58 pm, AndrewK <[EMAIL PROTECTED]> wrote: > You need to place your tag templates into the subdirectory called > "templates" of your application directory. > In that case >

Re: Templates for Custom Template Tags

2007-09-30 Thread AndrewK
You need to place your tag templates into the subdirectory called "templates" of your application directory. In that case django.template.loaders.app_directories.load_template_source would be able to found your custom tag template. And you don't need to add this directory's path to TEMPLATE_DIRS

Templates for Custom Template Tags

2007-09-30 Thread Steve Potter
I created a custom inclusion tag that makes use of a template file named menu_tag.html. I placed that file in the app's subdirectory of the template directory. When I tried to make use of it I got a template does not exist error. I was able to resolve this by adding the app's subdirectory to

Re: Custom template tags within a textarea field

2007-09-06 Thread MichaelMartinides
On Sep 6, 9:18 pm, RajeshD <[EMAIL PROTECTED]> wrote: > On Sep 5, 12:03 pm, MichaelMartinides <[EMAIL PROTECTED]> > wrote: > > > Hi, > > > Just to be sure. > > > If I have custom template tags within a TextAreafield of a model. I > > would do

Re: Custom template tags within a textarea field

2007-09-06 Thread RajeshD
On Sep 5, 12:03 pm, MichaelMartinides <[EMAIL PROTECTED]> wrote: > Hi, > > Just to be sure. > > If I have custom template tags within a TextAreafield of a model. I > would do something like to following: > > def view(request, page): > p = Page.object

Custom template tags within a textarea field

2007-09-05 Thread MichaelMartinides
Hi, Just to be sure. If I have custom template tags within a TextAreafield of a model. I would do something like to following: def view(request, page): p = Page.objects.get(name=page) t = Template( p.content ) content = t.render() return render_to_response('page.html', {content:content

Inheriting blocks inside custom template tags

2007-08-24 Thread Filipe Correia
I'm using a custom templatetag, named "ifgreaterthan", as seen here: http://nrcfosshelpline.in/code/browser/trunk/web/templatetags/base_utils.py When template inheritance *isn't* used, any {% block xyz %} that exists inside this tag shows correctly on the rendered page. However, if the content

Re: Redirecting within custom template tags

2007-07-06 Thread Jason F. McBrayer
neebone <[EMAIL PROTECTED]> writes: > Just to update, I'm getting the form to post to a different url which > handles the logic of creating the comment then redirects back to the > article page on success. All good. My only problem is what to do if > the form contains missing fields - I need to

Re: Redirecting within custom template tags

2007-07-06 Thread neebone
On Jul 6, 9:57 am, neebone <[EMAIL PROTECTED]> wrote: > On Jul 6, 9:46 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > > > > On Fri, 2007-07-06 at 08:26 +, neebone wrote: > > > [...] > > > > Ok, I've got a page which uses a generic view to load the article into > > > the template.

Re: Redirecting within custom template tags

2007-07-06 Thread neebone
On Jul 6, 9:46 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-07-06 at 08:26 +, neebone wrote: > > [...] > > > > > Ok, I've got a page which uses a generic view to load the article into > > the template. All good so far. I've then created two template tags, > >

Re: Redirecting within custom template tags

2007-07-06 Thread Malcolm Tredinnick
On Fri, 2007-07-06 at 08:26 +, neebone wrote: [...] > Ok, I've got a page which uses a generic view to load the article into > the template. All good so far. I've then created two template tags, > list_comments and comment_form. > list_comments is displayed first. The tag grabs the comments >

Re: Redirecting within custom template tags

2007-07-06 Thread neebone
On Jul 6, 9:13 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-07-06 at 08:04 +, neebone wrote: > > Hi, > > > I'm trying to roll my own comments custom template tag and need to > > action a browser redirect on successful comment posting. My problem is > > that you can't

Re: Redirecting within custom template tags

2007-07-06 Thread Malcolm Tredinnick
On Fri, 2007-07-06 at 08:04 +, neebone wrote: > Hi, > > I'm trying to roll my own comments custom template tag and need to > action a browser redirect on successful comment posting. My problem is > that you can't just return HttpResponseRedirect and expect it to be > executed. Is there an

Redirecting within custom template tags

2007-07-06 Thread neebone
Hi, I'm trying to roll my own comments custom template tag and need to action a browser redirect on successful comment posting. My problem is that you can't just return HttpResponseRedirect and expect it to be executed. Is there an "official" way to get the middleware to action the redirect from

defining wiki-like pages with custom template tags

2007-06-08 Thread omat
Hi all, For sometime, I was thinking of a flexible yet easy to manage CMS for creating wiki-like pages. That is: - content and presentation of each page should be defined freely and independently almost as free as in plain HTML documents when needed - common blocks of content and templates

Re: not getting custom template tags

2007-05-25 Thread Jeremy Dunck
On 5/25/07, Bob Dively <[EMAIL PROTECTED]> wrote: > > On May 25, 4:06 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > > That appears related to filters, somehow. Please include the full > > code for your templates. > > Not really feasible since there are dozens. Then try to simplify the

Re: not getting custom template tags

2007-05-25 Thread Bob Dively
On May 25, 4:06 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > That appears related to filters, somehow. Please include the full > code for your templates. Not really feasible since there are dozens. --~--~-~--~~~---~--~~ You received this message because you

Re: not getting custom template tags

2007-05-25 Thread Jeremy Dunck
On 5/25/07, Bob Dively <[EMAIL PROTECTED]> wrote: ... > Exception Type: TemplateSyntaxError > Exception Value:Could not parse the remainder: custom_tags > Exception Location: D:\python24\Lib\site-packages\django\template > \__init__.py in __init__, line 558 > > Still

Re: not getting custom template tags

2007-05-25 Thread Bob Dively
Thanks for the info, Jeremy. If I change register.simple_tag("media") to register.simple_tag(media), and I remove that extraneous path from INSTALLED_APPS, I now get this error, also from template/__init.py__: Exception Type: TemplateSyntaxError Exception Value:Could not parse

Re: not getting custom template tags

2007-05-25 Thread Jeremy Dunck
On 5/25/07, Bob Dively <[EMAIL PROTECTED]> wrote: This: > register.simple_tag("media") Should be this: register.simple_tag(media) And I doubt this is causing this problem, but this: > 'myapp.main.templatetags', shouldn't be in your INSTALLED_APPS. 'myapp.main' is the app; Django looks in

not getting custom template tags

2007-05-25 Thread Bob Dively
Despite several hours of poking around, I'm just not getting how to make custom template tags and would greatly appreciate a little hand holding. I've created a directory called "templatetags" that's in the same directory as models.py and views.py. In the templatetags director

Custom template tags: object does not support item assignment

2007-02-01 Thread plungerman
ect and make it availabe to the template for display without using a for loop or anything. for example. project.name, project.slug, project.description, etc. can anyone confirm for me that the custom template tags cannot return an object? if that is the case, what do folks do to display data in s

How To: Project-wide custom template tags

2006-12-01 Thread David Smith
Here's one method of importing a common set of tags into your app-specific templatetags modules. If there's an easier way, I'd appreciate the advice. 1. Define your common tags, e.g. /yourproject/apps/templatetags.py: from django import template register = template.Library() def

Re: generic views object_list & custom template tags

2006-08-04 Thread Malcolm Tredinnick
On Fri, 2006-08-04 at 21:50 -0700, bernie2004 wrote: > when using a generic views object_list, > i would like to know if there is a faster way to get all > the extra variables inside a custom template tag: > > {% navigation pages page has_previous has_next %} > > and > > @register.simple_tag >

generic views object_list & custom template tags

2006-08-04 Thread bernie2004
when using a generic views object_list, i would like to know if there is a faster way to get all the extra variables inside a custom template tag: {% navigation pages page has_previous has_next %} and @register.simple_tag def navigation( pages, page, has_previous, has_next ): ... create

Re: Custom template tags not loading

2006-06-15 Thread Corey Oordt
I'm going to bow my head in shame I was SURE that I put it there! Thanks for making me look ivan! Corey On Jun 15, 2006, at 5:19 PM, [EMAIL PROTECTED] wrote: > > make sure your application exists in the project's settings file > INSTALLED_APPS > > > >

Re: Custom template tags not loading

2006-06-15 Thread Corey Oordt
Don,Thanks for the reply. When I put in {% load reservations.reservationtags %} I get:'reservations.reservationtags' is not a valid tag library: Could not load template library from django.templatetags.reservationtags, No module named reservationtagsAny other ideas?Thanks,CoreyOn Jun 15, 2006, at

Re: Custom template tags not loading

2006-06-15 Thread Don Arbow
On Jun 15, 2006, at 2:05 PM, Corey wrote: > > Hi All! > > I've written a custom template tag, but I get the error: > 'reservationtags' is not a valid tag library: Could not load template > library from django.templatetags.reservationtags, No module named > reservationtags > > I've looked in the

Re: Custom template tags not loading

2006-06-15 Thread [EMAIL PROTECTED]
make sure your application exists in the project's settings file INSTALLED_APPS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Custom template tags not loading

2006-06-15 Thread Corey
Hi All! I've written a custom template tag, but I get the error: 'reservationtags' is not a valid tag library: Could not load template library from django.templatetags.reservationtags, No module named reservationtags I've looked in the archives and have tried everything I know so far: 1.

ANN: Backwards-incompatible change in trunk, for custom template tags/filters

2005-11-26 Thread Adrian Holovaty
Hi all, I've committed an rjwittams patch to trunk; among various improvements, it slightly refactors the way custom template tags and filters are registered. If you've written any custom template tags or filters, they will no longer work until you make the changes outlined here: http