Reverse mapping URLs: why?

2008-11-18 Thread stevedegrace
Hi guys, So, I'm learning Django for the first time and having fun, I really like it. Generally I'm finding it very practical and blessedly well- documented, especially compared to other Python frameworks I have explored. I'm using it for a personal project of mine that I wanted to do in python (

Re: Reverse mapping URLs: why?

2008-11-19 Thread stevedegrace
Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-11-18 at 19:46 -0800, stevedegrace wrote: > > [...] > > > I'm hoping someone more experienced with Django will explain the > > rationale for the preferred paradigm and show me where I have gone > > astray

Re: Reverse mapping URLs: why?

2008-11-19 Thread stevedegrace
On Nov 19, 12:04 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: [...] > (5) Using reverse() is often a lot more explicit than a writing the URL > out in full. Which of these is more immediately readable? > >         (a) /blog/archives/full-text/%s/ % (input1,) > >         (b) reverse("full-ar

Templatetag: parser is choking

2008-11-29 Thread stevedegrace
I have a weird problem. (I'm using Django 1.0.2, Python version 2.5.2 on Ubuntu 8.10). Say I have a template like this: """ {% sometag %} Some stuff {% someothertag %} Some more stuff {% yetanothertag %} Last stuff {% endsometag %} """ My template tag function looks something like this: @registe

Re: Templatetag: parser is choking

2008-11-29 Thread stevedegrace
and I'm just finishing up a nice little library for working with particular tree structures of arbitrary depth, the crown of which is this nice little recursive control structure I'm making. Everything else has been great, the parser kills me! On Nov 29, 9:37 pm, stevedegrace <[EM

Re: Templatetag: parser is choking

2008-11-30 Thread stevedegrace
correct. So I'm happier this morning. :) On Nov 29, 10:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sat, 2008-11-29 at 17:37 -0800, stevedegrace wrote: > > I have a weird problem. (I'm using Django 1.0.2, Python version 2.5.2 > > on Ubuntu 8.10).

OneToOneField blank=True null=True having an accident

2008-11-30 Thread stevedegrace
Another problem! I'm using Django 1.0.2, Python 2.5.2, on Ubuntu 8.10. I have a structure of keys and keyrings arranged in a tree of arbitrary depth which I decided to implement as a bunch of models: RootKeyRing, RootKey, SubKeyRing, SubKey (rather than as XML like maybe I should have done) becau

Re: OneToOneField blank=True null=True having an accident

2008-11-30 Thread stevedegrace
Nov 30, 10:26 am, stevedegrace <[EMAIL PROTECTED]> wrote: > Another problem! I'm using Django 1.0.2, Python 2.5.2, on Ubuntu 8.10. > > I have a structure of keys and keyrings arranged in a tree of > arbitrary depth which I decided to implement as a bunch of models: > Root

Changing the name of a project

2009-02-12 Thread stevedegrace
I think I might have bitten off more than I can chew here, heh, and I need some help. I just finished my project and it looks awesome on my computer at home (running Ubuntu Intrepid). But before I deployed it, I decided I didn't like the retarded name I gave the project and I wanted to change it.

Signals getting sent twice

2009-02-15 Thread stevedegrace
I realise going through Google that this has been hashed over before, but nevertheless, I want to know if there is any new thought on this. Ever since I removed project references from imports in my code, I have noticed a new problem whereby many functions connected to signals are being called twi

Re: Signals getting sent twice

2009-02-16 Thread stevedegrace
t, dispatch_uid='comments.post_comment') comment_was_flagged.connect(flag_comment, Comment, dispatch_uid='comments.flag_comment') On Feb 15, 8:46 pm, stevedegrace wrote: > I realise going through Google that this has been hashed over before, > but nevertheless, I want to know if there i

Django processes under Apache

2009-02-22 Thread stevedegrace
I don't think I'm understanding this very well. By doing some inspection, I see that Apache is running under two PIDs, which makes sense because ServerLimit right now is set to 2. What I'm wondering is, does each of those processes have a persistent instance of Django in its own python process wai

Django templates have lexical scope!?

2009-08-25 Thread stevedegrace
I just discovered something I did not expect. Apparently a Django template does not behave like its context is a single global scope where if you set a new variable using a custom template tag it can be accessed anywhere subsequently in the template. Variables you set into the context initially

Getting all unique values of a field with Django ORM

2009-08-30 Thread stevedegrace
Hi guys, I'm making a refback type linkback app for my hobby CMS. I want to find all the unique page targets. I am thinking broadly of a couple of ways to do it. One with the ORM sort of line this: targets = list(set([linkback.target_url for linkback in LinkBacks.objects.all()])) This seems lik

Re: Getting all unique values of a field with Django ORM

2009-08-31 Thread stevedegrace
Thanks guys! On Aug 30, 10:56 pm, Alex Gaynor wrote: > On Sun, Aug 30, 2009 at 9:37 PM, stevedegrace wrote: > > > Hi guys, > > > I'm making a refback type linkback app for my hobby CMS. I want to > > find all the unique page targets. I am thinking broadly of a

Weird problem with rendering a Variable in a custom tag

2011-05-22 Thread stevedegrace
I developed a custom tag to look up the country of a certain IP address using an IP to country database. It's sort of rough and ready, but it should work. The idea is that you read the comment.ip_address, feed it to the {% country %} tag, which then spits out the two letter country code. The intere

Re: Weird problem with rendering a Variable in a custom tag

2011-05-24 Thread stevedegrace
; (less expensive) or the comment. > > Brice Leroy > > On May 23, 2011, at 1:34 AM, bruno desthuilliers > wrote: > > > On May 23, 5:37 am, stevedegrace wrote: > >> I developed a custom tag to look up the country of a certain IP > >> address using an IP to c

Re: Weird problem with rendering a Variable in a custom tag

2011-05-24 Thread stevedegrace
And you are absolutely correct, using a local variable in the render method and not rebinding self,ip resolves the problem. Thank you very much. Can you explain why this is? On May 23, 5:34 am, bruno desthuilliers wrote: > On May 23, 5:37 am, stevedegrace wrote: > > > I developed

Re: Template tag render method doesn't get called

2014-02-16 Thread stevedegrace
This is a real problem. I have had the same issue, and I have seen several other people besides yourself bring this up without getting satisfactory answers. I was having the same problem where __init__ was being called but not render, where the purpose of the tag is to insert several variables