Re: announcement: SHPAML (alternative to haml)

2010-01-26 Thread Steve Howell
On Dec 29 2009, 1:44 pm, Durbin wrote: > very cool! any plans to integrate it fully into the django templating > system? Glad you like it. Amit Upadhyay has written a loader here: http://github.com/amitu/dutils/blob/master/dutils/shpaml_loader.py I've used shpaml mostly with django, but for my

announcement: SHPAML (alternative to haml)

2009-12-19 Thread Steve Howell
Hi, I have ported some haml concepts to Python in my implementation of SHPAML. Details here: http://shpaml.webfactional.com/ For those of you not aware of haml, haml is a markup language implemented in Ruby that allows you to eliminate end tags in HTML. Like Python itself, haml and SHPAML use in

Re: style guide/autoformatter/linter for Django templates?

2009-12-01 Thread Steve Howell
On Dec 1, 3:33 am, Tom Evans wrote: > On Tue, Dec 1, 2009 at 7:33 AM, Steve Howell wrote: > > Just following up on this a few days later, in case it got lost in the > > shuffle due to the weekend and U.S. holiday. > > > On Nov 27, 2:18 pm, Steve Howell wrote: > >

Re: style guide/autoformatter/linter for Django templates?

2009-11-30 Thread Steve Howell
Just following up on this a few days later, in case it got lost in the shuffle due to the weekend and U.S. holiday. On Nov 27, 2:18 pm, Steve Howell wrote: > I am wondering if there is a style guide anywhere for writing Django > templates.  Also, are there programs to automatically forma

Re: Stuck with simple query

2009-11-28 Thread Steve Howell
On Nov 28, 8:36 am, Benjamin Wolf wrote: > Hi, > > I'm trying to create a query like this with django: > SELECT count(*) As total FROM `disposal` group by(salesman_id) > > This gives me the number of total sales for every salesman. > In django I tried this: > data = Disposal.objects.annotate(tota

style guide/autoformatter/linter for Django templates?

2009-11-27 Thread Steve Howell
I am wondering if there is a style guide anywhere for writing Django templates. Also, are there programs to automatically format your templates...to indent block tags, for example? I know there are autoformatters for HTML, but I am not aware of any tools that handle Django tags. Also, it would b

Re: Issue when saving a model form

2009-11-27 Thread Steve Howell
I am not fully tracking to the problem here, but when it comes to overriding save() behavior on forms, I find the following helper to be handy: def build_instance_from_form(model_form): instance = model_form.save(commit=False) return instance Then in your view code do something like this:

Re: replicating database changes from one postgres DB to another

2009-07-23 Thread Steve Howell
On Jul 21, 3:18 pm, Wayne Koorts wrote: > Hi Steve, > > > We have an application where we periodically import data from an > > external vendor, and the process is mostly automated, but we need to > > review the data before having it go live. > > > We were considering an option where we would run

replicating database changes from one postgres DB to another

2009-07-21 Thread Steve Howell
We have an application where we periodically import data from an external vendor, and the process is mostly automated, but we need to review the data before having it go live. We were considering an option where we would run processes on another database, do the manual validation, and then replic

Re: get_or_create() returns "no such savepoint" error

2009-07-08 Thread Steve Howell
See below. On Jul 8, 10:49 am, Karen Tracey wrote: > On Tue, Jul 7, 2009 at 9:05 PM, Steve Howell wrote: > > > On Jul 7, 3:07 pm, Karen Tracey wrote: > > > > > On Jun 29, 10:53 am, Steve Howell wrote: > > > > > Hi, I have created a management command

Re: get_or_create() returns "no such savepoint" error

2009-07-07 Thread Steve Howell
On Jul 7, 3:07 pm, Karen Tracey wrote: > > > > On Jun 29, 10:53 am, Steve Howell wrote: > > > Hi, I have created a management command that populates some tables in > > > a Postgres database, and I use the handy get_or_create() method in db/ > > > mode

Re: get_or_create() returns "no such savepoint" error

2009-07-07 Thread Steve Howell
provide it now. On Jun 29, 10:53 am, Steve Howell wrote: > Hi, I have created a management command that populates some tables in > a Postgres database, and I use the handy get_or_create() method in db/ > models/query.py.  I tried running a command recently where I had > inadvertently

Re: PyDev users: how do you manage tabs?

2009-07-01 Thread Steve Howell
On Jun 30, 10:42 pm, Rex wrote: > Kind of a petty question: > > I've been using PyDev to do my Django work and find it to be great. > However, my only gripe is that it's hard to keep track of tabs, since > they display only the (non-qualified) file name, which is a problem > given Django's very

Re: no module name xxxx error

2009-06-29 Thread Steve Howell
On Jun 29, 11:05 am, nixon66 wrote: > I'm getting an error no module name x. I've create all the > directories and I can see them, but I keep getting this error and > can't understand why. Any ideas. Not sure why this is happening since > it did not happen when I've created other apps. Ther

get_or_create() returns "no such savepoint" error

2009-06-29 Thread Steve Howell
Hi, I have created a management command that populates some tables in a Postgres database, and I use the handy get_or_create() method in db/ models/query.py. I tried running a command recently where I had inadvertently left some foreign key references dangling around, but instead of a useful erro

Re: no module name xxxx error

2009-06-29 Thread Steve Howell
On Jun 29, 11:13 am, nixon66 wrote: > Steve, > > The is a __init__.py > Ok, you need to provide a little more detail then. Can you tell us what your subdirectory structure looks like, and have you put __init__.py's in enclosing folders? Sometimes modules fail to import due to syntax errors in

Re: why doesn't the "with" template tag transverse blocks?

2009-06-24 Thread Steve Howell
On Jun 23, 9:16 pm, Karen Tracey wrote: > > Raising some sort of error for child template content found outside of a {% > block %} seems like a more reasonable idea.  I have no idea if it's been > asked for/considered/rejected/etc., nor how hard it would be to do.  If you > are really intereste

Re: why doesn't the "with" template tag transverse blocks?

2009-06-23 Thread Steve Howell
that most folks who encounter this gotcha either work around it or go to a different templating system. The OP is using generics so will probably be wise to stick with django templates and slightly repetitive code. On Jun 23, 9:16 pm, Karen Tracey wrote: > On Tue, Jun 23, 2009 at 11:05 PM, St

Re: why doesn't the "with" template tag transverse blocks?

2009-06-23 Thread Steve Howell
On Jun 23, 7:29 pm, Karen Tracey wrote: > On Tue, Jun 23, 2009 at 10:16 PM, Steve Howell wrote: > > > Nothing posted is outside a block but it could be that the parent has > > no title block? > > I can't parse this sentence.  The part of the original post where

Re: why doesn't the "with" template tag transverse blocks?

2009-06-23 Thread Steve Howell
Nothing posted is outside a block but it could be that the parent has no title block? On Jun 23, 6:47 pm, Karen Tracey wrote: > On Tue, Jun 23, 2009 at 8:34 PM, nbv4 wrote: > > > I'm trying to set up a template for all my forms, but I'm having > > trouble using the {% with %} block: > > > {% ex

currying variables into ModelForm subclasses

2009-06-23 Thread Steve Howell
I have an application with a single method called member_create that presents a form to collect membership information and save it to the database. Depending on the project configuration and user I have different membership forms, so I have a line of code like this in member_create(): member

ANN: elif added to smart_if tag

2009-06-17 Thread Steve Howell
For those of you who, like me, have enjoyed SmileyChris's excellent smart if tag, you may find the following extension useful: http://www.djangosnippets.org/snippets/1572/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Re: Template Question

2009-06-17 Thread Steve Howell
Another option is to install the snippet below, which supports "in": http://www.djangosnippets.org/snippets/1350/ On Jun 17, 1:53 pm, Ben Davis wrote: > Nope, you'll need to set a variable in your view.  You can also try creating > your own filter such that {% if friend|is_in_group %}  would wo

Re: Problem with performance on a django site

2009-05-28 Thread Steve Howell
On May 28, 8:19 am, jrs_66 wrote: > 250 queries on one page seems to me to be dangerously high.  I would > have to guess you could reduce that significantly.  Turn on query > output to see if the Django ORM isn't creating sloppy queries in > loops.  My guess is that with some code alterations you

Re: Mutiple template inheritance

2009-05-28 Thread Steve Howell
On May 28, 7:26 am, "Daniele Procida" wrote: > On Thu, May 28, 2009, Masklinn wrote: > >> I need to create some templates that will cover a number of cases: > > >>    display navigation menu: yes or no > >>    display additional info box: yes or no > > >> In other words, there are a total of fo

Re: Weird problem in url resolving after restarting django dev. server

2009-05-27 Thread Steve Howell
On May 27, 8:23 am, Konstantin S wrote: > On May 26, 9:28 pm, Steve Howell wrote: > > [...] > > Perhaps you can try to step through the code in the debugger.  The top- > > level method involved in reversing URLs are not super complicated. > > You can set

Re: Weird problem in url resolving after restarting django dev. server

2009-05-26 Thread Steve Howell
On May 26, 6:43 am, Konstantin S wrote: > On May 20, 2:02 pm, Konstantin S wrote: > > > Hello! > > > I have a very strange problem and really don't know where to start in > > hunting it down. My app uses django-registration, all works fine but > > if I been logged in restart django dev. server

Re: Weird problem in url resolving after restarting django dev. server

2009-05-20 Thread Steve Howell
On May 20, 10:49 am, Konstantin S wrote: > On 20 май, 19:43, Steve Howell wrote: > > > > > To elaborate on Karen's suggestion, one way to see which URLs are > > among the candidates for resolving the reverse match is to > > deliberately hit a bad URL like t

Re: Callable objects instead of functions in views.py

2009-05-20 Thread Steve Howell
On May 20, 6:33 am, Filip Gruszczyński wrote: > > I have recently created a class: > > class RequestService: > >         def __call__(self, request, *args, **kwargs): >                 self.prepare(request, *args, **kwargs) >                 if request.method == 'POST': >                        

Re: Weird problem in url resolving after restarting django dev. server

2009-05-20 Thread Steve Howell
On May 20, 6:41 am, Karen Tracey wrote: > On Wed, May 20, 2009 at 7:28 AM, Konstantin S wrote: > > > On 20 май, 14:02, Konstantin S wrote: > > > Hello! > > > > I have a very strange problem and really don't know where to start in > > > hunting it down. My app uses django-registration, all works

Re: Template tags and variables overlapping

2009-05-03 Thread Steve Howell
On May 3, 1:15 pm, Julián C. Pérez wrote: > > example: > {% createLink "a link to something" src "class attr" "id attr" "title > attri" %} > would output something like: > a > link to something > > how can i make the 'src' input to be the result of url tag calling a > valid view?? I recommend t