Re: NoReverseMatch when trying to use get_absolute_url with custom template tag

2017-03-30 Thread Will Holmes
Oh yeah i see. Brilliant sorted it! Thanks for your help Melvyn. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To p

Re: NoReverseMatch when trying to use get_absolute_url with custom template tag

2017-03-29 Thread Melvyn Sopacua
On Wednesday 29 March 2017 09:16:17 Will Holmes wrote: > url(r'^(?P\d+)$/', views.viewEvent, name='viewevent'), name = viewevent > def get_absolute_url(self): > return reverse('cal:viewEvent', args=[str(self.id)], > current_app='cal') name = viewEvent > Sorry about the load of

NoReverseMatch when trying to use get_absolute_url with custom template tag

2017-03-29 Thread Will Holmes
I am making a calendar app which has a custom template tag that takes the python HTML template function and overlays objects from the Events model on the correct days. I am trying to get the displayed objects to have a link directly to an object detail/edit view and am trying to use

Re: extend Media in custom template tag

2017-02-22 Thread guettli
/41592766/django-include-media-css-js-in-class-based-views Am Montag, 9. Mai 2016 10:25:49 UTC+2 schrieb guettli: > > I have a custom Django template tag which creates HTML. > > > This HTML needs some JS and CSS. > > > How can I extend the media list with my custom template t

Re: extend Media in custom template tag

2017-02-22 Thread guettli
which creates HTML. > > > This HTML needs some JS and CSS. > > > How can I extend the media list with my custom template tag? > > > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe fro

Re: Custom Template Tag

2016-09-15 Thread 'Abraham Varricatt' via Django users
gt;>> >>> Thanks, >>> >>> Al >>> >>> On Thursday, September 1, 2016 at 8:09:29 AM UTC-4, ludovic coues wrote: >>>> >>>> I wouldn't do it this way. >>>> Personally, I would make the POST request in the view func

Re: Custom Template Tag

2016-09-10 Thread Al Johri
1, 2016 at 8:09:29 AM UTC-4, ludovic coues wrote: >>> >>> I wouldn't do it this way. >>> Personally, I would make the POST request in the view function, put >>> the return value in the context. The template isn't a good place to >>> hav

Re: Custom Template Tag

2016-09-01 Thread Constantine Covtushenko
ally, I would make the POST request in the view function, put >> the return value in the context. The template isn't a good place to >> have logic. It should only take data and format them. >> >> 2016-09-01 5:33 GMT+02:00 Al Johri : >> > Hi Django Users, &g

Re: Custom Template Tag

2016-09-01 Thread Al Johri
, put > the return value in the context. The template isn't a good place to > have logic. It should only take data and format them. > > 2016-09-01 5:33 GMT+02:00 Al Johri >: > > Hi Django Users, > > > > I want to make a custom template tag wher

Re: Custom Template Tag

2016-09-01 Thread ludovic coues
t; I want to make a custom template tag where the tag's renderer needs to make > a POST request. > > https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/#writing-the-renderer > https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/#thread-safety-considerati

Custom Template Tag

2016-09-01 Thread Al Johri
Hi Django Users, I want to make a custom template tag where the tag's renderer needs to make a POST request. https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/#writing-the-renderer https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/#thread-safety-considera

extend Media in custom template tag

2016-05-09 Thread guettli
I have a custom Django template tag which creates HTML. This HTML needs some JS and CSS. How can I extend the media list with my custom template tag? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: Problem with a token in my custom template tag

2014-10-15 Thread Daniel Grace
I got it working thanks. My template tag file is as follows: from django import template from django.utils import timezone register = template.Library() @register.simple_tag def rowcolour(dt): diff = timezone.now() - dt if diff.days > 14: return "pinkrow" else: return "greyrow" -- You receive

Re: Problem with a token in my custom template tag

2014-10-15 Thread Daniel Roseman
On Wednesday, 15 October 2014 19:30:01 UTC+1, Daniel Grace wrote: > > Hi, > I'm encountering the following problem with a token in my custom template > tag: > Request Method: GET > Request URL: http://127.0.0.1:8000/flows/ > Django Version: 1.7 > Exception Type:

Problem with a token in my custom template tag

2014-10-15 Thread Daniel Grace
Hi, I'm encountering the following problem with a token in my custom template tag: Request Method: GET Request URL: http://127.0.0.1:8000/flows/ Django Version: 1.7 Exception Type: ValueError Exception Value: need more than 2 values to unpack Exception Location: C:\landy\cresta\flow\templat

Access request object in a custom template tag

2013-04-29 Thread Ponytech
Hello, I am currently writing a custom template tag and I need to access the request object within the tag code. When using tag helpers (*simple_tag*, *inclusion_tag *and *assignment_tag*) you can register them with an additional takes_context=True parameter that makes the request object

How to retrieve an object from a custom template tag?

2013-03-16 Thread Andre Lopes
Hi all, I'm trying to retrieve an object from a custom template tag. This is possible? I explain here with details what I'm expecting to do? http://stackoverflow.com/questions/15450003/django-how-to-retrieve-an-object-from-a-custom-template-tag Any clues? What is the best way to av

Re: Custom template tag problem: "No module named models"

2012-11-08 Thread nolurking
I had the same issue, fixed it with a variation on Jim D.'s solution. import bookmarks then bookmarks.models.Bookmark.objects.filter(...) On Tuesday, October 14, 2008 11:38:20 PM UTC-7, Chris Amico wrote: > > I have a simple bookmarks model based on the one in James Bennett's href="http://code.

Re: Is there a way to use 'request.user' in a custom template tag without an inclusion tag?

2012-07-29 Thread Ash Courchene
Well holy crap!! context['user'] worked perfectly! I thought I would have to come up with some crazy workaround! Thank you kindly sir. On Sunday, 29 July 2012 15:03:13 UTC-4, Ash Courchene wrote: > > So I made a custom template tag that allows pieces of content to be edite

Re: Is there a way to use 'request.user' in a custom template tag without an inclusion tag?

2012-07-29 Thread Tomas Neme
> > class EditableNode(template.Node): > def __init__(self, location_name): > self.location_name = location_name.encode('utf-8').strip("'") > def render(self, context): > obj = Placeholder.objects.filter(location=self.location_name) > if request.user.is_authenticated(): > for x in obj: > return

Is there a way to use 'request.user' in a custom template tag without an inclusion tag?

2012-07-29 Thread Ash Courchene
So I made a custom template tag that allows pieces of content to be edited by the site administrator with the click of a link. For instance, if i put {% editable 'index_block_one' %}, it would return whatever content is in the Placeholder model I created with the name "index_

Translation hooks in custom template tag

2012-06-28 Thread Владислав Митов
Hello, I can't make this feature > *{% some_special_tag _("Page not found") value|yesno:_("yes,no") %} * to work with this custom template tag - http://djangosnippets.org/snippets/1289/ with django 1.4. The result from {% breadcrumb _("Create") %} is _(

Re: comparing custom template tag within if tag

2012-03-30 Thread Tom Evans
On Thu, Mar 29, 2012 at 5:42 PM, Nikhil Verma wrote: > Hi All > > I am still not able to solve this problem .Any more suggestions ? > > Thanks > Because there is no solution. You must rewrite the custom tag to set a variable in the context, which you can then test in your 'if' tag. The link in m

Re: comparing custom template tag within if tag

2012-03-29 Thread Nikhil Verma
Hi All I am still not able to solve this problem .Any more suggestions ? Thanks On Thu, Mar 29, 2012 at 10:03 PM, Tom Evans wrote: > On Thu, Mar 29, 2012 at 5:22 PM, Josh Cartmell > wrote: > > I think something like this would work: > > {% with price_for_pax service pax '' as pfp %} > > It wo

Re: comparing custom template tag within if tag

2012-03-29 Thread Tom Evans
On Thu, Mar 29, 2012 at 5:22 PM, Josh Cartmell wrote: > I think something like this would work: > {% with price_for_pax service pax '' as pfp %} It won't. The {% with %} tag cannot arbitrarily call custom tags. Cheers Tom -- You received this message because you are subscribed to the Google G

Re: comparing custom template tag within if tag

2012-03-29 Thread Josh Cartmell
r whatever equaled service.price, and then use it more directly. Regards, Josh On Mar 29, 1:54 am, Tom Evans wrote: > On Wed, Mar 28, 2012 at 4:59 PM, Nikhil Verma > wrote: > > Hi all > > > i have a custom template tag that takes some argument and calculates the > &g

Re: comparing custom template tag within if tag

2012-03-29 Thread Tom Evans
On Wed, Mar 28, 2012 at 4:59 PM, Nikhil Verma wrote: > Hi all > > i have a custom template tag that takes some argument and calculates the > result. > I want to compare that value obtained from that custom tag with another > variable. > > Custom template tag > {

comparing custom template tag within if tag

2012-03-28 Thread Nikhil Verma
Hi all i have a custom template tag that takes some argument and calculates the result. I want to compare that value obtained from that custom tag with another variable. Custom template tag {% price_for_pax service pax '' %} variable : {{service.price}} What i want is {% if ser

Custom template tag for django-voting

2012-03-27 Thread Fabio Natali
Hi everybody, I have a weird problem with a custom template tag I made. The template tag is built on top of django-voting app and provides upvote and downvote counts, while standard django-voting tags only provides total number of votes and score. Here is the snippet I wrote: http

Custom template tag - share data

2012-03-19 Thread mikegolf
Hi, lets say I want my templatetag to collect menu items from all the rendered template pieces. I thought of writing custom templatetag which would work as following: this would be called in "sub-template" {% register_menu_item "some item" "/someItem/view" %} and finally the "main" template woul

Re: custom template tag. success message after form-submit in the same .html file

2011-08-15 Thread Konstantin Sushenko
hello, you can just add a context variable 'submitted' to your context in your view's get_context_data konstantin On Aug 15, 4:06 am, doniyor wrote: > Hi There, > > I am heading well now, but have still some confusing things here.. > > this is my html file, where i want to get a success message

custom template tag. success message after form-submit in the same .html file

2011-08-15 Thread doniyor
Hi There, I am heading well now, but have still some confusing things here.. this is my html file, where i want to get a success message after the form is submitted: __ {% load forms %} {% if submitted %}

Re: How do I apply a filter in a custom template tag?

2011-08-14 Thread Josh
Thanks, I've added a function to the Enty models. It doesn't in some cases I get good returns now. But not always. Content is the name of the app. There is no PK-relation on the Category class, but only the below on the Entry class. class Entry(models.Model): categories = models.ManyToManyF

Re: How do I apply a filter in a custom template tag?

2011-08-13 Thread Doug Ballance
re of the categories for that Content instances Entry instance You could do a custom template tag like yours: {% get_related_entries content_instance.entry as related_entries %} That tag would do something like the following : #fetching primary key only since we don't need the whole thing ca

How do I apply a filter in a custom template tag?

2011-08-13 Thread Josh
The obj simulates a single Entry in a template for use in the shell. I'm trying to put this in a custom template tag, so a list of related entries can be shown with a blog entry. I cooked up the following: {% load content_tags %} {% get_related_entries content.

Re: Custom template tag -- Not registered?

2011-04-29 Thread Kenny Meyer
On Fri, Apr 29, 2011 at 5:11 PM, Daniel Roseman wrote: > On Friday, 29 April 2011 21:24:44 UTC+1, Kenny Meyer wrote: >> >> Hello, >> >> I have the following inclusion tag in templatetags/show_submissions.py : >> >> ## BOF >> >> register = template.Library() >> >> @register.inclusion_tag('competiti

Re: Custom template tag -- Not registered?

2011-04-29 Thread Daniel Roseman
On Friday, 29 April 2011 21:24:44 UTC+1, Kenny Meyer wrote: > > Hello, > > I have the following inclusion tag in templatetags/show_submissions.py : > > ## BOF > > register = template.Library() > > @register.inclusion_tag('competition/templatetags/show_submissions.html') > def show_submissions(parti

Custom template tag -- Not registered?

2011-04-29 Thread Kenny Meyer
Hello, I have the following inclusion tag in templatetags/show_submissions.py : ## BOF register = template.Library() @register.inclusion_tag('competition/templatetags/show_submissions.html') def show_submissions(participant): submissions = Submission.objects.get(participant=participant)

Re: problem loading custom template tag

2010-12-19 Thread Nate Reed
My mistake. There was a small typo. It was called __init.py__, not __init__.py. I fixed it and it works now. Thanks, Nate On Sun, Dec 19, 2010 at 9:20 PM, Nate Reed wrote: > Karen, thanks for your reply.   The module myapp/templatetags does > have an __init__.py file.  There is no __init__.p

Re: problem loading custom template tag

2010-12-19 Thread Nate Reed
Karen, thanks for your reply. The module myapp/templatetags does have an __init__.py file. There is no __init__.pyc file, though. n...@nate-desktop:~/work/django-projects/myproject/myapp$ ls templatetags/ mytags.py __init.py__ On Sun, Dec 19, 2010 at 8:59 PM, Karen Tracey wrote: > On Sun, De

Re: problem loading custom template tag

2010-12-19 Thread Karen Tracey
On Sun, Dec 19, 2010 at 8:40 PM, Nate Reed wrote: > When I try to import my module in the shell I also am unable to import it: > > >>> from django.templatetags import mytags > Traceback (most recent call last): > File "", line 1, in > ImportError: cannot import name mytags > >>> from myapp.temp

problem loading custom template tag

2010-12-19 Thread Nate Reed
Hi, I'm using Django 1.2.1 and I'm having problems trying to load my template tags: {% load mytags %} TemplateSyntaxError at /myapp/ 'mytags' is not a valid tag library: Template library mytags not found, tried django.templatetags.mytags It's defined in myproject/myapp/templatetags/mytags.py.

Re: Problems displaying image objects in a Django template using a custom template tag? (coding included)

2010-10-21 Thread tricks...@googlemail.com
Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this gro

Re: Problems displaying image objects in a Django template using a custom template tag? (coding included)

2010-10-20 Thread werefr0g
Hello, I think you should use something like alt="{{ object.title }}" /> in your template: you want to output images' url in your template, not the "object" itself. You'll find explanations in [1] and [2]. Regards [1] http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.

Problems displaying image objects in a Django template using a custom template tag? (coding included)

2010-10-20 Thread tricks...@googlemail.com
I have the following code that fails to display object images. But displays normal images fine. My Model class News(models.Model): title--- image = models.ImageField(upload_to='images') body Template tag coding from django import template register = template.Library() from -

Re: How to share Custom Template Tag in other APP?

2010-09-06 Thread funcrush
Thank you Daniel!! I'll try it!! :) On Sep 3, 8:45 pm, Daniel Roseman wrote: > On Sep 3, 9:27 am, funcrush wrote: > > > Hi, all. > > I wrote acustomtemplatetagpackage in aappthat named Blogs. > > And I madeotherappnamed SMS. > > But I don't know how to use thecustomtemplatetagthat located Blogs

Re: How to share Custom Template Tag in other APP?

2010-09-03 Thread Daniel Roseman
On Sep 3, 9:27 am, funcrush wrote: > Hi, all. > I wrote a custom template tag package in a app that named Blogs. > And I made other app named SMS. > But I don't know how to use the custom template tag that located Blogs > in SMS app. > If anybody know, please help me. &g

How to share Custom Template Tag in other APP?

2010-09-03 Thread funcrush
Hi, all. I wrote a custom template tag package in a app that named Blogs. And I made other app named SMS. But I don't know how to use the custom template tag that located Blogs in SMS app. If anybody know, please help me. thank you :) -- You received this message because you are subscrib

Re: Custom template tag for a chaptered document?

2010-01-03 Thread Tomasz Zieliński
ite a custom template tag and use it in a > template and from a view?? Or is there already something like this out > there You could write a function that does what you need and can be used in views, then write template tag as an thin adaptor around this function - so that you can use it in tem

Custom template tag for a chaptered document?

2009-12-29 Thread Stodge
I need to write a custom tag. I have a hierarchy of objects that I want to turn into a chaptered document. But I want to be able to build and display the document in a template AND generate a PDF or other format from a view. Can I write a custom template tag and use it in a template and from a

Re: Is it possible to use custom template tag inside another tag?

2009-10-05 Thread Andrius A
Thanks for advice! On Oct 4, 2009 9:23 PM, "AmanKow" wrote: > custom tag is a function - cant you just assing its return in view > into variable and send this... The usual way to go about this would be to modify your tag to take an optional "as var_name". When the tag has the optional portion,

Re: Is it possible to use custom template tag inside another tag?

2009-10-04 Thread AmanKow
> custom tag is a function  - cant you just assing its return in view > into variable and send this variable to template? The usual way to go about this would be to modify your tag to take an optional "as var_name". When the tag has the optional portion, you would update the value into the varia

Re: Is it possible to use custom template tag inside another tag?

2009-10-03 Thread Aaron Watters
(troll alert) What you need is to use WHIFF configuration templates which allow recursive embedding of "tags" (applications really). As far as I know WHIFF can't be used in Django because Django can't embed an arbitrary WSGI application (I'd love to be wrong). Nevertheless, please check out: htt

Re: Is it possible to use custom template tag inside another tag?

2009-10-03 Thread Maksymus007
On Sat, Oct 3, 2009 at 4:01 PM, Andrew wrote: > > Anyway, I thound that's not possible, so I will need to create > specific custom tag for this. > > On Oct 3, 2:07 pm, Andrew wrote: >> Hello, >> >> is there any way to use custom template tag inside {if}

Re: Is it possible to use custom template tag inside another tag?

2009-10-03 Thread Andrew
Anyway, I thound that's not possible, so I will need to create specific custom tag for this. On Oct 3, 2:07 pm, Andrew wrote: > Hello, > > is there any way to use custom template tag inside {if} or ifequal > tag? > > I have custom tag "getpreference" which ac

Is it possible to use custom template tag inside another tag?

2009-10-03 Thread Andrew
Hello, is there any way to use custom template tag inside {if} or ifequal tag? I have custom tag "getpreference" which accepts one parameter and returns string value or empty "" string. I want to check if value is not empty inside {if} or maybe {ifequal} tag, how

Re: Custom template tag problem: "No module named models"

2009-10-01 Thread Karen Tracey
On Thu, Oct 1, 2009 at 8:47 PM, shacker wrote: > > Found the problem. There were no namespace problems in my template > tag, but there were (are) in the external app I'm using, which is the > RSS aggregator used by the djangoproject.com site itself: > > > http://code.djangoproject.com/browser/dja

Re: Custom template tag problem: "No module named models"

2009-10-01 Thread shacker
On Oct 1, 4:00 pm, Karen Tracey wrote: > > Yes, you must simply ensure you name things in such a way that the models > module you want to access is not hidden by something else. The original > problem noted in the thread you reference resulted from re-using the > application's name (bookmarks) a

Re: Custom template tag problem: "No module named models"

2009-10-01 Thread Karen Tracey
On Thu, Oct 1, 2009 at 6:16 PM, shacker wrote: > > Google apparently won't let me reply to an older thread: > > http://groups.google.com/group/django-users/browse_thread/thread/94239f017df4b12f > so starting a new one. > > I too was hitting the "No module named models" problem when creating a > t

Custom template tag problem: "No module named models"

2009-10-01 Thread shacker
Google apparently won't let me reply to an older thread: http://groups.google.com/group/django-users/browse_thread/thread/94239f017df4b12f so starting a new one. I too was hitting the "No module named models" problem when creating a template tag. I had the tag working perfectly when it communicat

Re: Relative imports in custom template tag collections seem to look in the wrong place.

2009-06-15 Thread greatlemer
On Jun 15, 10:47 pm, Alex Gaynor wrote: > On Mon, Jun 15, 2009 at 4:39 PM, greatlemer wrote: > > > > > > > Hi everyone, > > > I was creating some custom template tags and attempted to import my > > models through the following import at the top of the file: > > > from ..models import * > > > Unfo

Re: Relative imports in custom template tag collections seem to look in the wrong place.

2009-06-15 Thread Alex Gaynor
On Mon, Jun 15, 2009 at 4:39 PM, greatlemer wrote: > > Hi everyone, > > I was creating some custom template tags and attempted to import my > models through the following import at the top of the file: > > from ..models import * > > Unfortunately this seems to be attempting to import from django.m

Relative imports in custom template tag collections seem to look in the wrong place.

2009-06-15 Thread greatlemer
Hi everyone, I was creating some custom template tags and attempted to import my models through the following import at the top of the file: from ..models import * Unfortunately this seems to be attempting to import from django.models (which doesn't exist) rather than myapp.models and therefore

Re: Custom Template Tag - Passing variable for use in tag processing

2009-01-29 Thread phoebebright
This is the final code which works in case it helps anyone else. Thanks again. In the template: {% page_links category %} In templatetags file @register.tag(name="page_links") def get_page_links(parser,token): tag_name, category = token.contents.split() return PageLink(cate

Re: Custom Template Tag - Passing variable for use in tag processing

2009-01-29 Thread phoebebright
You understood perfectly. It was just another case of my not understanding the documentation. Your explanation makes perfect sense. Many thanks. On Jan 27, 6:45 pm, Eric Abrahamsen wrote: > On Jan 28, 2009, at 1:52 AM, phoebebright wrote: > > > > > > > I have duplicated as best I can the proc

Re: Custom Template Tag - Passing variable for use in tag processing

2009-01-27 Thread Eric Abrahamsen
e.objects.filter > (is_live=True).select_related().order_by('order') > >else: >pages = False > > self.pages = pages > >def render(self, context): >context['pages'] = self.pages > >return '&#x

Custom Template Tag - Passing variable for use in tag processing

2009-01-27 Thread phoebebright
I have duplicated as best I can the processing for handling variables in custom template tags mentioned in an earlier post but it's not working for me as I need the value of the variable before I parse it. Is there another way of making the variable available? The tag is being called from the tem

Re: Custom template tag problem: "No module named models"

2008-11-18 Thread bruno desthuilliers
On 15 oct, 09:19, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2008-10-15 at 01:08 -0700, bruno desthuilliers wrote: > > [...] > > > FWIW, I just don't understand why each an every example in the > > Django's manual insists on using this projectname.appname scheme. > > "Insists" is a

Re: Custom template tag problem: "No module named models"

2008-11-18 Thread Jim D.
I came across this thread and was having the exact same problem. *Exactly* the same... I had tried everything you tried to no avail. I actually fixed it by taking a hint from something that came out of following along with your debug session in my own code. I'll put my solution in terms of your

Re: Custom Template Tag with {% end... %} tag

2008-10-20 Thread Erik Allik
I guess it was easier for me to type it myself than search through the new documentation. :) Erik On 20.10.2008, at 5:49, James Bennett wrote: > > On Sun, Oct 19, 2008 at 4:20 PM, Erik Allik <[EMAIL PROTECTED]> wrote: >> In the compilation function of your template tag, you can force the >> p

Re: Custom Template Tag with {% end... %} tag

2008-10-19 Thread James Bennett
On Sun, Oct 19, 2008 at 4:20 PM, Erik Allik <[EMAIL PROTECTED]> wrote: > In the compilation function of your template tag, you can force the > parser to parse until tag named "endyourcustomtag" by calling nodelist > = parser.parse(("endyourcustomtag", ). This will return the contents > of your blo

Re: Custom Template Tag with {% end... %} tag

2008-10-19 Thread Siah
Thank you! Sia On Oct 19, 5:20 pm, Erik Allik <[EMAIL PROTECTED]> wrote: > In the compilation function of your template tag, you can force the   > parser to parse until tag named "endyourcustomtag" by calling nodelist   > = parser.parse(("endyourcustomtag", ). This will return the contents   > of

Re: Custom Template Tag with {% end... %} tag

2008-10-19 Thread Erik Allik
In the compilation function of your template tag, you can force the parser to parse until tag named "endyourcustomtag" by calling nodelist = parser.parse(("endyourcustomtag", ). This will return the contents of your block tag as a list of nodes. Finally you can "drop off" the end tag by ca

Custom Template Tag with {% end... %} tag

2008-10-19 Thread Siah
Hi, I can't understand how template tags such as if, for and ifequal manage to have an accompanying endif, endfor and endifequal, and I can't have it. Or I can't manage to find out how to do it. So, I basically want to do something like: {% customTag %} hello {% endcustomTag %} and within my cu

Re: Custom template tag problem: "No module named models"

2008-10-17 Thread Chris Amico
I think it's fixed now. After much refreshing (I'm editing in Coda) a bookmarks.pyc file appeared. Once that was gone, the tag library did load correctly. I have a different error coming up now, which I'll try to fix or post separately if I can't. Thanks for the help and patience, folks. On Oct

Re: Custom template tag problem: "No module named models"

2008-10-16 Thread Chris Amico
OK, tried all that, got pretty much the same results: >> import bookmarks >>> dir(bookmarks) ['__builtins__', '__doc__', '__file__', '__name__', '__path__', 'models'] >>> bookmarks.__file__ '/home/chrisamico/lib/python2.5/bookmarks/__init__.pyc' >>> from bookmarks import templatetags >>> dir(temp

Re: Custom template tag problem: "No module named models"

2008-10-16 Thread felix
oh well. check that you have an __init__.py file in the templatetags directory try this: in bookmark_tags.py (and do keep the name that way, or later you will be caught by this) right before the import line throw it in into the debugger: import pdb; pdb.set_trace() in the debugger try: >>> i

Re: Custom template tag problem: "No module named models"

2008-10-15 Thread Chris Amico
Tried that. Still no good. I renamed the file as bookmark_tags.py and deleted every .pyc file in the app. Nothing in my templatetags directory actually compiled--neither __init__.py nor bookmarks.py (even after being renamed). Like I said before, when I take out the import line (from bookmarks.mo

Re: Custom template tag problem: "No module named models"

2008-10-15 Thread felix
this gets me every time. the error is yes because the template tag is called bookmarks.py and its inside a module called bookmarks.py rename it to bookmarks_tags.py ... and now DELETE THE DAMNED OLD bookmarks.pyc file ! python is still finding the old compiled file. its happened to me

Re: Custom template tag problem: "No module named models"

2008-10-15 Thread Chris Amico
Wish it were that easy. The app is installed, and it works everywhere else. If I take out the {% load bookmarks %} from the template, the rest of the app works fine. I have a view that bookmarks an object, and it checks if a user has bookmarked that object first. This is how I did it in the view

Re: Custom template tag problem: "No module named models"

2008-10-15 Thread RyanP
Seems like the problem's got to be with the "from bookmarks.models import Bookmark" line. The "No module named models" part of your error message suggests that Django doesn't know about your bookmarks/models.py ... if that app is on your Pyton path, any chance that it's just not listed in your IN

Re: Custom template tag problem: "No module named models"

2008-10-15 Thread Chris Amico
The templatetag file is indeed called bookmarks.py. I thought of that, tried renaming it as bookmark_tags.py, and got the same error. I'll add that the bookmarks app lives on my python path, not in any particular project, since I'm trying to make this as reusable as possible. At one point, I trie

Re: Custom template tag problem: "No module named models"

2008-10-15 Thread Daniel Roseman
On Oct 15, 7:38 am, Chris Amico <[EMAIL PROTECTED]> wrote: > I have a simple bookmarks model based on the one in James Bennett's href="http://code.google.com/p/cab/source/browse/trunk/models.py? > r=130">Cab application. I'm using a generic relation so it can > live in its own app and a user can

Re: Custom template tag problem: "No module named models"

2008-10-15 Thread Malcolm Tredinnick
On Wed, 2008-10-15 at 01:08 -0700, bruno desthuilliers wrote: [...] > FWIW, I just don't understand why each an every example in the > Django's manual insists on using this projectname.appname scheme. "Insists" is a rather strong word, since nowhere does it say "do this or else". Also, out of al

Re: Custom template tag problem: "No module named models"

2008-10-15 Thread bruno desthuilliers
On 15 oct, 08:45, Daniel Roseman <[EMAIL PROTECTED]> wrote: (snip otherwise sound advises) > although I would also > recommend using full paths when importing (ie from > projectname.bookmarks.models). No. *Don't*. If you do so, imports will break when renaming the directory or trying to reuse

Custom template tag problem: "No module named models"

2008-10-15 Thread Chris Amico
I have a simple bookmarks model based on the one in James Bennett's http://code.google.com/p/cab/source/browse/trunk/models.py? r=130">Cab application. I'm using a generic relation so it can live in its own app and a user can bookmark any object on the site (I'm planning on reusing this app on a c

Re: media server implementation - context processor, custom template tag, or custom filter

2008-06-23 Thread phillc
template filter is approx: > > @register.filter > @stringfilter > def get_file_version(value, arg): >     if arg in STATIC_ASSETS: >         value = STATIC_ASSETS[arg] + arg; >     else: >         value = arg; >     return value > > 2) simple custom template tag > templates

media server implementation - context processor, custom template tag, or custom filter

2008-06-22 Thread alex
STATIC_ASSETS: value = STATIC_ASSETS[arg] + arg; else: value = arg; return value 2) simple custom template tag templates look like: template tag code: @register.simple_tag def get_file_version(arg): value = arg if arg in ASSET_LIST: value = ASSET_LIST[arg] +

Re: Grrr, can't import custom template tag

2008-04-28 Thread Jay
Hi! Yes, in fact on the development server it works fine. On the production server I'm using lighttpd/fcgi, and I have stopped and restarted both approximately 800 times. It's very strange. I feel like it must be something to do with my server configuration. I have the exact same versions of

Re: Grrr, can't import custom template tag

2008-04-28 Thread David Reynolds
On 28 Apr 2008, at 1:35 am, Jay wrote: > And I think that's it. This is really driving me crazy. Is there > anything I'm forgetting? Anything obvious? I would be extremely > grateful if someone could give this a once-over and let me know what > I'm missing. If you're running on Apache, have

Re: Grrr, can't import custom template tag

2008-04-27 Thread Jay
Even more frustrating is that I just checked in the python shell and can successfully load paginate: #python Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

Grrr, can't import custom template tag

2008-04-27 Thread Jay
Hi, all. I think I have an uncommon problem here--I've been looking into it for hours, and it's driving me crazy. I'm trying to install a custom paginator template tag in Django revision 7403. I'm getting the error message: 'paginate' is not a valid tag library: Could not load template library

Re: Custom template tag

2008-01-13 Thread Alessandro Ronchi
2008/1/13, Alex Koshelev <[EMAIL PROTECTED]>: > > 'templatetags' instead of 'templatetag' > '{% load feed_import %}' instead of '{% load feedimport %}' My error wasn't that (I made a mistake writing here). It was a failed import inside the tag, and that caused the error without the correct error

Re: Custom template tag

2008-01-13 Thread Alex Koshelev
'templatetags' instead of 'templatetag' '{% load feed_import %}' instead of '{% load feedimport %}' On 13 янв, 19:47, Alessandro <[EMAIL PROTECTED]> wrote: > I'm trying to create a custom template tag. I've added a feedimport > app in

Re: Custom template tag

2008-01-13 Thread Alexey Moskvin
The correct directory for your tags is "templatetags", not "templatetag" On 13 янв, 19:47, Alessandro <[EMAIL PROTECTED]> wrote: > I'm trying to create a custom template tag. I've added a feedimport > app in my project, added it on my installed apps,

Custom template tag

2008-01-13 Thread Alessandro
I'm trying to create a custom template tag. I've added a feedimport app in my project, added it on my installed apps, and inside it I've created a templatetag directory with a file feed_import.py Both feedimport and templatetag dirs have an empty __init__.py file. I'

Re: (solved) Re: Custom template tag and filters in resolve_variable

2007-12-06 Thread Manakel
On Dec 5, 2007 7:09 PM, Michal Ludvig <[EMAIL PROTECTED]> wrote: > > > > > Michal Ludvig wrote: > > > > for the project I'm working on I needed to create a custom template tag, > > > call it 'mytag'. > > > > If I use it

Re: (solved) Re: Custom template tag and filters in resolve_variable

2007-12-06 Thread Empty
on I needed to create a custom template tag, > > call it 'mytag'. > > > > If I use it as {% mytag something %} everything goes fine (where > > 'something' is a string passed to the template). > > However I can't add any filters to tha

(solved) Re: Custom template tag and filters in resolve_variable

2007-12-05 Thread Michal Ludvig
Michal Ludvig wrote: > for the project I'm working on I needed to create a custom template tag, > call it 'mytag'. > > If I use it as {% mytag something %} everything goes fine (where > 'something' is a string passed to the template). > However I ca

Re: Custom template tag and filters in resolve_variable

2007-12-05 Thread Michal Ludvig
Rune Bromer wrote: > On Dec 5, 2007, at 11:59 AM, Michal Ludvig wrote: > >> Hi all, >> >> for the project I'm working on I needed to create a custom template >> tag, >> call it 'mytag'. >> >> If I use it as {% mytag something %} e

  1   2   >