Re: print_r() in Django & SQL debug output

2009-05-02 Thread Dan Mallinger
Hi Okto, I feel confident saying that Malcolm knows the ins and outs of Django far better than I do :) But, for what it's worth, I really like the logging package here: http://code.google.com/p/django-logging/wiki/Overview It's super easy and reasonably powerful. And if you install Sphinx, it'll

Re: django setting problem on windows

2009-05-02 Thread Malcolm Tredinnick
On Sat, 2009-05-02 at 22:24 -0700, online wrote: > I have mod_python set working fine with apache. > > I have django setting as following at apache > > > ServerAdmin webmas...@dummy-host2.li > Do

django setting problem on windows

2009-05-02 Thread online
I have mod_python set working fine with apache. I have django setting as following at apache ServerAdmin webmas...@dummy-host2.li DocumentRoot "C:/depot/projects/web/" ServerName web Serv

Re: passing current datetime to generic view archive_year in a decoupled url

2009-05-02 Thread Malcolm Tredinnick
On Sat, 2009-05-02 at 21:00 -0700, josebrwn wrote: > Hi, I'm trying to pass the current year the date based view > archive_year using the "url" template tag, and I'm stuck trying to get > the current time to resolve. this works just fine: > > {% now > "Y" %} > > but this (as well as many variat

passing current datetime to generic view archive_year in a decoupled url

2009-05-02 Thread josebrwn
Hi, I'm trying to pass the current year the date based view archive_year using the "url" template tag, and I'm stuck trying to get the current time to resolve. this works just fine: {% now "Y" %} but this (as well as many variations) {% now "Y" %} gets: NoReverseMatch: Reverse for 'cms.coltr

Re: print_r() in Django & SQL debug output

2009-05-02 Thread Malcolm Tredinnick
On Sun, 2009-05-03 at 09:48 +0700, Okto Silaban wrote: > On Sun, May 3, 2009 at 9:27 AM, Malcolm Tredinnick > wrote: > > > > How are you rendering that template? The only thing I can > think of that > will go wrong here is if you do not pass a Re

Re: print_r() in Django & SQL debug output

2009-05-02 Thread Okto Silaban
On Sun, May 3, 2009 at 9:27 AM, Malcolm Tredinnick wrote: > > How are you rendering that template? The only thing I can think of that > will go wrong here is if you do not pass a RequestContext to > render_to_response() -- or whatever rendering method you are using. > Context processors only run

Re: print_r() in Django & SQL debug output

2009-05-02 Thread Malcolm Tredinnick
On Sun, 2009-05-03 at 07:47 +0700, Okto Silaban wrote: > > > On Sun, May 3, 2009 at 7:04 AM, George Song wrote: > > > Django has extensive documentation. It's advisable that you > look it up > first before asking: > > >

Re: Avatars in comments

2009-05-02 Thread Malcolm Tredinnick
On Sat, 2009-05-02 at 15:22 -0700, trancos123 wrote: > [Sorry for my poor english] > Hi > I'm using a django.contrib.comments for my application (with django- > profile), and i want to add the user avatar > in every comment. > How can i do this? > I'm searching for a tutorial about this, but i can

Re: Altering database object

2009-05-02 Thread Michael
On Sat, May 2, 2009 at 9:37 PM, George Song wrote: > I think the easiest solution for you is to write a custom method on your > Score model: > You might also want to look at writing a template tag or filter. In this case a simple filter would be: from django import template registry = templat

Re: Loading a filter module for all templates: possible?

2009-05-02 Thread Michael
On Sat, May 2, 2009 at 8:44 PM, Rex wrote: > > I have a module called myfilters.py that contains my custom filters. > Is there some way around putting the command "{% load myfilters %}" in > every template I want to use a custom filter in? I tried putting the > load command in a base template, bu

Re: Altering database object

2009-05-02 Thread George Song
On 5/2/2009 6:24 PM, Vedlen wrote: > I've got multiple tuples, and I need all the fields. > I just need to pass all the "moment" fields from the tuples, into my > function. > > Here is what my template looks like : > > > {{ for s in Score }} > {{ s.moment }}{{ s.someOtherField }} > {{ endfor }}

Re: Altering database object

2009-05-02 Thread Vedlen
I've got multiple tuples, and I need all the fields. I just need to pass all the "moment" fields from the tuples, into my function. Here is what my template looks like : {{ for s in Score }} {{ s.moment }}{{ s.someOtherField }} {{ endfor }} It's like I'd need to do this : {{ for s in Score

Re: print_r() in Django & SQL debug output

2009-05-02 Thread Okto Silaban
On Sun, May 3, 2009 at 7:04 AM, George Song wrote: Django has extensive documentation. It's advisable that you look it up > first before asking: > > < > http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-debug > > Default : DEBUG = True TEMPLATE_DEBUG = DEBUG

Loading a filter module for all templates: possible?

2009-05-02 Thread Rex
I have a module called myfilters.py that contains my custom filters. Is there some way around putting the command "{% load myfilters %}" in every template I want to use a custom filter in? I tried putting the load command in a base template, but templates that inherit from this one don't appear to

Re: print_r() in Django & SQL debug output

2009-05-02 Thread George Song
On 5/2/2009 4:53 PM, Okto Silaban wrote: > Ok, I know this is not a PHP mailing list.. I just want to make the > question simpler. > > I'm coming from CakePHP background. > > 1. What Django template tags can I use to replace print_r() / var_dump() > in PHP? > 2. How can I display SQL debug out

print_r() in Django & SQL debug output

2009-05-02 Thread Okto Silaban
Ok, I know this is not a PHP mailing list.. I just want to make the question simpler. I'm coming from CakePHP background. 1. What Django template tags can I use to replace print_r() / var_dump() in PHP? 2. How can I display SQL debug output? *in cakePHP I can use debug() function to show the SQL

Avatars in comments

2009-05-02 Thread trancos123
[Sorry for my poor english] Hi I'm using a django.contrib.comments for my application (with django- profile), and i want to add the user avatar in every comment. How can i do this? I'm searching for a tutorial about this, but i can't find nothing. Thanks for your help --~--~-~--~~---

Re: Help beginner again: templatetags.

2009-05-02 Thread zayatzz
Ohwell.. In the process of learning django i have this project that pretty much does nothing. at first i used development server to test-run it, then i installed apache and other required stuff and moved my project into another folder. I set up my httpd.conf to read from the new folder and i th

Job opening: Software Architect/Developer in Emeryville - Photo Imaging web leader

2009-05-02 Thread Mark Liebman, Pictopia
Hi, I am the founder/president of Pictopia.com, the internet's leading "photo commerce" fulfillment provider. We help market the photography of major media organizations directly to consumers. We have over 800 partners' photo archives including The Washington Post, The AP, Reuters, and National Ge

Re: Help beginner again: templatetags.

2009-05-02 Thread Michael Newman
On May 2, 2009, at 1:58 PM, zayatzz wrote: > > No matter. i figured out the cause, but now i have different how... > not one suitable for this thread >> >> >> >> >> >> Alan; Glad you got it figured out. It would be helpful to the people who might be of will be following this thread to hear

Re: Help beginner again: templatetags.

2009-05-02 Thread zayatzz
Yup i was. The problem was that somehow my httpd.conf was loading wrong project at all... Because of i put django install directory into my httpd.conf pythonpath line. All fixed now. And i can report that the templatetag is fixed too. Sorry for causing such a mess... kinda blushing now... Ala

Re: Help beginner again: templatetags.

2009-05-02 Thread zayatzz
Yup i was. The problem was that somehow my httpd.conf was loading wrong project at all... Because of i put django install directory into my httpd.conf pythonpath line. All fixed now. And i can report that the templatetag is fixed too. Sorry for causing such a mess... kinda blushing now... Ala

Re: Create a web service for an existing stand alone python script

2009-05-02 Thread George Song
On 5/2/2009 10:01 AM, pallavi wrote: > Dear Mr.George, > > Thank a lot for your help. > But, in the python program "science.py" there are several functions > that do some calculations by reading the values in the two input > files. > > your code: >> from science import my_function >

Re: Altering database object

2009-05-02 Thread Daniel Roseman
On May 2, 3:39 pm, Vedlen wrote: > Hi everybody, > > I started working with Django very recently and I'm basically a PHP > developer so I'm pretty much confused with lots of different things > right now as I'm getting used to Django ;) > > Here's my problem : > > First off, I fetch values from my

Re: Debug middleware

2009-05-02 Thread George Song
On 5/2/2009 9:53 AM, Malcolm Tredinnick wrote: > On Sat, 2009-05-02 at 04:11 -0700, Kless wrote: >> How to debug a middleware? I would print any variables for a >> middleware that I'm building >> >> Is there any way to make it? > > In any sensible web server setup, printing to sys.stderr will sen

Re: Help beginner again: templatetags.

2009-05-02 Thread zayatzz
No matter. i figured out the cause, but now i have different how... not one suitable for this thread though. Alan. On May 2, 8:52 pm, zayatzz wrote: > this must be some kind of magic, cause: > > The time is {% current_time "%Y-%m-%d %I:%M %p" %}. > > is all what my arts.html contains now. > > B

Re: Help beginner again: templatetags.

2009-05-02 Thread zayatzz
No matter. i figured out the cause, but now i have different how... not one suitable for this thread though. Alan. On May 2, 8:52 pm, zayatzz wrote: > this must be some kind of magic, cause: > > The time is {% current_time "%Y-%m-%d %I:%M %p" %}. > > is all what my arts.html contains now. > > B

Re: Help beginner again: templatetags.

2009-05-02 Thread Daniel Roseman
On May 2, 6:52 pm, zayatzz wrote: > this must be some kind of magic, cause: > > The time is {% current_time "%Y-%m-%d %I:%M %p" %}. > > is all what my arts.html contains now. > > But i > 1) cleared firefox cache > 2) disabled caching from ff's web developer toolbar > 3) disabled firebug just in c

Re: Help beginner again: templatetags.

2009-05-02 Thread zayatzz
this must be some kind of magic, cause: The time is {% current_time "%Y-%m-%d %I:%M %p" %}. is all what my arts.html contains now. But i 1) cleared firefox cache 2) disabled caching from ff's web developer toolbar 3) disabled firebug just in case 4) restarted computer and i still get the same

Re: Help beginner again: templatetags.

2009-05-02 Thread Malcolm Tredinnick
On Sat, 2009-05-02 at 10:30 -0700, zayatzz wrote: > > > Start without the extends for a little while. > > I did - the outcome is still the same - stuff from index.html gets > loaded. > > >I still think that is the > > problem. If it isn't that, than there is a CSS or some other styling that is

Re: Help beginner again: templatetags.

2009-05-02 Thread zayatzz
> Start without the extends for a little while. I did - the outcome is still the same - stuff from index.html gets loaded. >I still think that is the > problem. If it isn't that, than there is a CSS or some other styling that is > hiding your markup. You can look and see if that is case by view

Re: offline population of django auth user table

2009-05-02 Thread Malcolm Tredinnick
On Sat, 2009-05-02 at 09:09 -0700, Jeff wrote: > I'm using Django's authentication. I would like to add several users > through a command-line script (not through code executed via the > website). Something like manage.py createsuperuser but for normal > users and not interactive. I want to be

Re: Proper way to rescue transaction after IntegrityError using postgres?

2009-05-02 Thread Malcolm Tredinnick
On Sat, 2009-05-02 at 06:57 -0700, Charlie DeTar wrote: > Karen Tracey wrote: > > Thing is, a side-effect of dealing with a test that raises an > > IntegrityError, using PostgreSQL, is you need a working rollback in > > order to recover. So, even though you may not be interested in actually > > t

Re: Debug middleware

2009-05-02 Thread Malcolm Tredinnick
On Sat, 2009-05-02 at 04:11 -0700, Kless wrote: > How to debug a middleware? I would print any variables for a > middleware that I'm building > > Is there any way to make it? In any sensible web server setup, printing to sys.stderr will send the output the server's error log. With Django's devel

Re: offline population of django auth user table

2009-05-02 Thread Carl Karsten
On Sat, May 2, 2009 at 11:09 AM, Jeff wrote: > > I'm using Django's authentication.  I would like to add several users > through a command-line script (not through code executed via the > website).  Something like manage.py createsuperuser but for normal > users and not interactive.  I want to be

offline population of django auth user table

2009-05-02 Thread Jeff
I'm using Django's authentication. I would like to add several users through a command-line script (not through code executed via the website). Something like manage.py createsuperuser but for normal users and not interactive. I want to be able to put code like this in a script I can run offlin

Re: Recursive Model Setup in Admin - Error (null, blank = True)

2009-05-02 Thread Anthony
Well, I figured it out. I needed to rerun they 'syncdb' command after making my change. Thanks for reading! On May 2, 8:49 am, Anthony wrote: > On May 2, 1:32 am, Daniel Roseman > wrote: > > > On May 2, 8:48 am, Anthony wrote: > > > My model: > > > > class Bracket(models.Model): > > >    

Re: getting no such table error

2009-05-02 Thread George Song
On 5/2/2009 8:32 AM, tekion wrote: > No, I ended up removing the db and recreating it via manage.py > syncdb. it works after this. > > Next time I will log into SQL lite and check it out. > > I am curious why running "manage.py syncdb" didn't work until I blow > away the db and re-run it. Is i

Re: Recursive Model Setup in Admin - Error (null, blank = True)

2009-05-02 Thread Anthony
On May 2, 1:32 am, Daniel Roseman wrote: > On May 2, 8:48 am, Anthony wrote: > > My model: > > > class Bracket(models.Model): > >     m = models.ForeignKey(OtherModel) > > <- no problem with this > >     parent = models.ForeignKey('self', blank=True

Re: Help beginner again: templatetags.

2009-05-02 Thread Michael
On Sat, May 2, 2009 at 2:00 AM, zayatzz wrote: > This indeed is major clue that i did not think of before. But i think > that the problem is not what you think - the arts block is in > front.index.html. > > It seems i have some kind of cache problem - since when i comment out > (or delete) lorem

Re: getting no such table error

2009-05-02 Thread tekion
No, I ended up removing the db and recreating it via manage.py syncdb. it works after this. Next time I will log into SQL lite and check it out. I am curious why running "manage.py syncdb" didn't work until I blow away the db and re-run it. On May 2, 10:56 am, George Song wrote: > On 5/2/2009

Re: Displaying rows as columns

2009-05-02 Thread George Song
On 5/2/2009 7:40 AM, George Song wrote: > Pass `entries` and `schedule` as context vars to your template, and > you can iterate through your schedule using ordered list of entries. There's also `django.utils.datastructures.SortedDict` so you can bypass the `entries` business and save yourself a

Altering database object

2009-05-02 Thread Vedlen
Hi everybody, I started working with Django very recently and I'm basically a PHP developer so I'm pretty much confused with lots of different things right now as I'm getting used to Django ;) Here's my problem : First off, I fetch values from my database : s = Score.objects.filter(blablabla).o

Re: Accessing related object data in template

2009-05-02 Thread George Song
On 5/2/2009 6:07 AM, Paddy Joy wrote: > I have a model "Car" with a related model "Car_Attribute" where I > store instance specific details. > > > class Car(models.Model): > name = models.CharField(max_length=50) > > class Car_Attribute(models.Model): > car = models.ForeignKey(Car) >

Re: getting no such table error

2009-05-02 Thread George Song
On 5/2/2009 6:02 AM, tekion wrote: > Exception Type: OperationalError at /play_django/page/start/save/ > Exception Value: no such table: mywiki_page_tags Did you log into SQLite and see if that table exists? -- George --~--~-~--~~~---~--~~ You received this mess

temporarily log in as another user

2009-05-02 Thread Dave Brueck
Hi all, I would like an admin user on my site to be able to temporarily "become" a normal user and see the site as if logged in as that normal user. However, I also need to retain one admin-related permission after I become the normal user. On my site there are admin users that aren't staff or s

Re: Displaying rows as columns

2009-05-02 Thread George Song
On 5/1/2009 5:47 PM, mamco wrote: > In attempting to get a better grasp of Django, I'm attempting a fairly > simple timecard app. Multiple users of a small chain of retail > stores, where occasionally the employees jump between stores(company), > and between projects and activities. > > The inte

Re: Proper way to rescue transaction after IntegrityError using postgres?

2009-05-02 Thread Charlie DeTar
Karen Tracey wrote: > Thing is, a side-effect of dealing with a test that raises an > IntegrityError, using PostgreSQL, is you need a working rollback in > order to recover. So, even though you may not be interested in actually > testing rollback itself, you need it to work for this test to run >

Accessing related object data in template

2009-05-02 Thread Paddy Joy
I have a model "Car" with a related model "Car_Attribute" where I store instance specific details. class Car(models.Model): name = models.CharField(max_length=50) class Car_Attribute(models.Model): car = models.ForeignKey(Car) key = models.CharField(max_length=50) data = models.

getting no such table error

2009-05-02 Thread tekion
Folks, I am following a tutorial. I am getting the following error even after I ran manage.py syncdb: Traceback: File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "C:\Docume

Re: using django 1.1 beta and having problem with cleaned_data attribute

2009-05-02 Thread tekion
Thanks again. It works after the the second underscore. On Apr 26, 8:18 pm, Alex Gaynor wrote: > On Sun, Apr 26, 2009 at 8:17 PM, tekion wrote: > > > Doh!!!, I can't believe I missed that.  Thanks that work. > > > I ran into another issue with Page.objects.filter, namely: > > Exception Value:

Debug middleware

2009-05-02 Thread Kless
How to debug a middleware? I would print any variables for a middleware that I'm building Is there any way to make it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, sen

Re: Displaying rows as columns

2009-05-02 Thread mamco
@George great question. In a very long ago php implementation of something similar with Access as a backend, I simply queried the date range in question, and built up an array, then walked through that while building the html table. It was ugly and even had some queries right in along the tr/td

[ANN] django-piston

2009-05-02 Thread jespern
Hi list, For some time, I've been working on a Django-app for creating APIs. This was specifically crafted for Bitbucket.org, but we decided early on to make it reusable for others, since there's a lack of code in this area. It's been making its rounds on HN and proggit seeing it's only alpha, b

Re: Recursive Model Setup in Admin - Error (null, blank = True)

2009-05-02 Thread Daniel Roseman
On May 2, 8:48 am, Anthony wrote: > I'm trying to instantiate a recursive object model via the admin, but > am getting an error. > > My model: > > class Bracket(models.Model): >     m = models.ForeignKey(OtherModel) >     parent = models.ForeignKey('self', blank=True, null=True) >     name = mode

Re: A way to specify different template code for every 6th item in a list?

2009-05-02 Thread Daniel Roseman
On May 2, 7:28 am, "Chris O'Donnell" wrote: > I'm using the Blueprint CSS framework and need to be able to have > every 6th list item processed with different code than every  1st-5th. > I guess you could do some sort of "is divisible by 6" thing, but I'm > not sure exactly what's entailed to get

Recursive Model Setup in Admin - Error (null, blank = True)

2009-05-02 Thread Anthony
I'm trying to instantiate a recursive object model via the admin, but am getting an error. My model: class Bracket(models.Model): m = models.ForeignKey(OtherModel) parent = models.ForeignKey('self', blank=True, null=True) name = models.CharField(max_length = 30) The error: Integr