Re: Problem with generic views in tutorial example

2008-08-23 Thread Anurag Goel
Apologies - I did not mention that my original urls.py (under mysite/, at the same level as polls/) still exists (the urls.py has to be copied over as opposed to moved), and it contains the following code: --mysite/urls.py begin-- from django.conf.urls.defaults import * # Uncomment the

Re: Problem with generic views in tutorial example

2008-08-23 Thread Anurag Goel
And in my first reply, I meant 'mysite/polls/urls.py' when I said: ' . I did however, do something that the tutorial did not ask to do - i.e. delete all references to the admin in mysite/urls.py, which looks like this ' On Aug 22, 1:38 am, Rodney Topor <[EMAIL PROTECTED]> wrote: > On

Re: Composite Forms? Are widgets the right thing to use?

2008-08-23 Thread Daniel Roseman
On Aug 23, 2:33 am, Jeff Anderson <[EMAIL PROTECTED]> wrote: > There is no reason that you couldn't include multiple forms in an HTML > post operation. You just have to make sure that there won't end up being > duplicate fields across forms. > In fact, there isn't even any reason to worry about

Re: Hi

2008-08-23 Thread Dmitry Dzhus
manitta wrote: > But when i try giving a request it does takes a screen shot. > unfortunately am not able to see the screenshot..:( > the screenshot is getting uploaded.. all data is visible but jus the > blank page.. How do you start your application? The screenshot is taken because somehow

QuerySets are scary!

2008-08-23 Thread Viktor Nagy
I just noticed that yourqueryset[0].save() is not the same as yourqueryset0 = yourqueryset[0] yourqueryset0.save() at least the first didn't gave the expected outcome for me see the attached test (it is enough to look at app/tests.py) is this true or both my test and real code

Re: QuerySets are scary!

2008-08-23 Thread Vitja Makarov
2008/8/23 Viktor Nagy <[EMAIL PROTECTED]>: > I just noticed that > >yourqueryset[0].save() > > is not the same as > >yourqueryset0 = yourqueryset[0] >yourqueryset0.save() > > at least the first didn't gave the expected outcome for me > > see the attached test (it is enough to look at

Re: QuerySets are scary!

2008-08-23 Thread James Bennett
On Sat, Aug 23, 2008 at 3:57 AM, Viktor Nagy <[EMAIL PROTECTED]> wrote: > is this true or both my test and real code are simply wrong? I was > kinda shocked from this The problem here is basically conceptual. You've assumed that, because it supports some of the same operations as a list, a

HTML in ValidationError?

2008-08-23 Thread coan
I try to do a raise forms.ValidationError('oh no'), but the HTML tags are escaped when I render my form as {{ form }}. Tried to do raise forms.ValidationError(mark_safe('oh no')), but the HTML-tags are still escaped. Any way to get around this?

how to get {% url %} working with {% blocktrans %}?

2008-08-23 Thread Viktor Nagy
Hi! I need a url in a blocktrans message, but I have no clue how to do it. it would be intuitive to use {% blocktrans url app.views.add as createurl %} and then {{ createurl }} but it didn't work for me. could someone help me, please! Viktor

urlpatterns and generic views cheatsheet

2008-08-23 Thread DavidY
Here is a summary of all the tutorials and docs that I have read on urlpatterns and generic views. It is a 2 page, concise, example code based cheat sheet. http://www.scribd.com/doc/4975790/urlpatterns-for-django-cheatsheet --~--~-~--~~~---~--~~ You received this

Noob: form class location

2008-08-23 Thread Gerard Petersen
Hi All, Im working on forms, going through this book: http://www.djangobook.com/en/1.0/chapter07/ I need to place a form class like this somewhere: class ContactForm(forms.Form): topic = forms.ChoiceField(choices=TOPIC_CHOICES) message = forms.CharField(widget=forms.Textarea())

Re: Noob: form class location

2008-08-23 Thread Julien Phalip
Hi, In Django there are no 'standard' as such. You'd talk more about 'conventions'. One common way is to put all your forms in forms.py. But that's just for cleanliness. Python lets you create whatever architecture you like for your apps. So, basically, do whatever you feel most comfortable with

Re: Noob: form class location

2008-08-23 Thread Russell Keith-Magee
On Sat, Aug 23, 2008 at 8:59 PM, Julien Phalip <[EMAIL PROTECTED]> wrote: > > Hi, > > In Django there are no 'standard' as such. You'd talk more about > 'conventions'. > One common way is to put all your forms in forms.py. But that's just > for cleanliness. While this is a common convention, I

Re: Noob: form class location

2008-08-23 Thread Gerard Petersen
Julien/Russell, Thanx for the info. Working around the name class would simply be resolved by a 'myforms.py' (or something). One thing is still missing in my brain though. If I put it in a myforms.py. How does Django (or my code if you will) knows where to find this class. There should be an

Re: simple form question

2008-08-23 Thread nonight
have a study. On 8月21日, 下午6时56分, patrickk <[EMAIL PROTECTED]> wrote: > you could use modelforms, > seehttp://www.djangoproject.com/documentation/modelforms/ > > or without modelforms: > > class MyForm(forms.Form): > > def __init__(self, user, *args, **kwargs): > self.user = user >

Re: Not displaying data...

2008-08-23 Thread mccomas . chris
Actually. I was wrong. It is not displaying the right number of rows... On Aug 23, 11:06 am, [EMAIL PROTECTED] wrote: > I have the following code,http://dpaste.com/73388/ > > For some reason the data in the rows is not displaying, there are the > correct number of rows in each table so the for

Re: How to filter FOO_set in templates?

2008-08-23 Thread Benjamin Buch
Am 22.08.2008 um 23:15 schrieb Garrett Garcia: > How about: > > songs = Recording.objects.filter(song__title__startswith='R', > represents_song=True) > > http://www.djangoproject.com/documentation/db-api/#filter-kwargs > > "Multiple parameters are joined via AND in the underlying SQL >

Re: Not displaying data...

2008-08-23 Thread DailyPuppyGuy
Should you have: {{ object.start_date }} instead of just: {{ start_date }} ?? On Aug 23, 11:29 am, [EMAIL PROTECTED] wrote: > Actually. I was wrong. It is not displaying the right number of > rows... > > On Aug 23, 11:06 am, [EMAIL PROTECTED] wrote: > > > I have the following

Re: Boosting your productivity when debugging Django apps

2008-08-23 Thread Taylor
I find the unit test and python shell to work very well for debugging. If you have never used unit testing... learn it and love it, and love how well it is built into django. I will usually write a unit test right after I have finished programming something, and then work with the test, using the

Re: Not displaying data...

2008-08-23 Thread mccomas . chris
Actually I was completely wrong, I figured it out though and it is working properly now. thnx! On Aug 23, 12:37 pm, DailyPuppyGuy <[EMAIL PROTECTED]> wrote: > Should you have: > > {{ object.start_date }} > > instead of just: > > {{ start_date }} > > ?? > > On Aug 23, 11:29 am, [EMAIL PROTECTED]

Sum Values in DB

2008-08-23 Thread mccomas . chris
I have entries from the different users, they're entering the total number of steps they walked during a particular period of time, that they set. So the model is setup like user (fk) start_date = DateField() end_date = DateField() steps = IntergerField() What I want to do is on the user's

Re: Sum Values in DB

2008-08-23 Thread [EMAIL PROTECTED]
The django ORM does not currently have native support for aggregates. However there is a super promising GSOC project that was just completed, and will likely go in shortly after 1.0(since we are in feature freeze for now), so your options are to: a) use the patch the GSOC student has here:

Re: Init Parameter Trouble

2008-08-23 Thread Robert
Any Thoughts On Aug 21, 10:51 pm, Robert <[EMAIL PROTECTED]> wrote: > Sure, it's: > > [code > > from quizmodo.base.forms import ClassEventForm > > class StackForm(ClassEventForm): > name = forms.CharField(max_length=100) > description = forms.CharField(widget=forms.Textarea) > anonymous =

list_filter for my own views

2008-08-23 Thread timc3
On quite a few pages I am using the standard generic views, mostly wrapped, but not always. Anyway I would like to use a list_filter on my own views, much like the admins - filter by date, by boolean or whatever. I can see the long way around of building up a query, though this will probably

Re: Composite Forms? Are widgets the right thing to use?

2008-08-23 Thread [EMAIL PROTECTED]
Some sort of composite form metaclass would be cool, you can always write something like that and host it elsewhere. On Aug 23, 2:57 pm, Jon Loyens <[EMAIL PROTECTED]> wrote: > Thanks guys!  Using multiple forms + prefixes is exactly what I need! > > Would be nice if there was some global

Re: How to filter FOO_set in templates?

2008-08-23 Thread Benjamin Buch
Am 22.08.2008 um 23:15 schrieb Garrett Garcia: > How about: > > songs = Recording.objects.filter(song__title__startswith='R', > represents_song=True) > > http://www.djangoproject.com/documentation/db-api/#filter-kwargs > > "Multiple parameters are joined via AND in the underlying SQL >

Processing multiple forms in same page

2008-08-23 Thread Archis
Hi Everyone, I am new to Django. I have page in which I have two forms. I am not able to find a way how to differentiate between the post of the two forms. I have separate functions to be called for post action of each of these two forms. Can anyone provide a solution ? Thanks Archis

Is it possible to use Django + Postgresql on leopard?

2008-08-23 Thread Theme Park Photo, LLC
I have been unable to get Django + Postgres to run on Leopard. (Works fine on Windows and Linux. Personally, I find it much easier to get most open source stuff to run on Windows or Windows+Cygwin than on the Mac!) Anyway, the problem isn't Django, and it isn't Postgres. It's psycopg2! I can't

Accessing manytomany relationships...

2008-08-23 Thread Jesst
So I'm trying to access a manytomany relationship in my template but it comes out as something like [Classes : testing] on the web-page. Models : class Classes(models.Model): title = CharField(max_length=40) class Testing(models.Model): classes = ManyToManyField(Classes) URLs :

Form validation

2008-08-23 Thread [EMAIL PROTECTED]
Hi, My form has 2 fields. One charfield, and the other is a charfield with a multiline widget. The form displays fine. When I submit it with data it correctly redirects to /success/ however if I submit the form with a field not filled in it tells me that views.index didn't return an

Re: Form validation

2008-08-23 Thread [EMAIL PROTECTED]
OK, I've found why it wasn't returning an httpresponseobject. It was because I wasn't returning a render_to_response on validation fail. However I cannot get my errors to show on the form. Any ideas ? --~--~-~--~~~---~--~~ You received this message because you are

Re: Form validation

2008-08-23 Thread Karen Tracey
On Sat, Aug 23, 2008 at 4:34 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote: > > OK, I've found why it wasn't returning an httpresponseobject. It was > because I wasn't returning a render_to_response on validation fail. > However I cannot get my errors to show on the form. Any ideas ? > Follow

Re: Form validation

2008-08-23 Thread [EMAIL PROTECTED]
Thanks for your reply Karen. I have been following those docs. If I use it literally it is missing an else after is_valid. Otherwise it tests for POST - if exist test is valid - if is invalid and is POST it returns no response object. That is why I felt I had to return the form again - I was

Re: Is it possible to use Django + Postgresql on leopard?

2008-08-23 Thread timc3
Try this: wget http://www.initd.org/pub/software/psycopg/psycopg2-latest.tar.gz tar -xzvf psycopg2-latest.tar.gz cd psycopg2-2.0.7/ python setup.py build sudo python setup.py install This is if the setup.cfg is alright for your Postgres installation, if not you might have to change setup.cfg to

Re: Processing multiple forms in same page

2008-08-23 Thread timc3
In your view you need to send both forms with different names and then in the template access each form. Like so: t = firstForm() p = secondForm() objContext = RequestContext(request, {'firstform': t, 'secondform': p}) return render_to_response('formtemplate.html',

Re: Form validation

2008-08-23 Thread [EMAIL PROTECTED]
This seems to have done the trick. Thanks for your help. def index(request): if request.method == 'POST': form = pasteForm(request.POST) if form.is_valid(): name = form.cleaned_data['name'] log = form.cleaned_data['log'] return

FileStorage S3Storage Error importing storage module S3Storage

2008-08-23 Thread tom
Hi, I am trying to move all my FileFields and ImageFields Items to S3. Therefore I changed the settings DEFAULT_FILE_STORAGE = 'S3Storage.S3Storage'. I tried to follow the steps described on http://code.larlet.fr/doc/django-s3-storage.html but I get a Error importing storage module S3Storage:

Re: How to filter FOO_set in templates?

2008-08-23 Thread Garrett Garcia
On Sat, Aug 23, 2008 at 11:50 AM, Benjamin Buch <[EMAIL PROTECTED]> wrote: > > Am 22.08.2008 um 23:15 schrieb Garrett Garcia: > > How about: > > songs = Recording.objects.filter(song__title__startswith='R', > represents_song=True) > >

Re: Is it possible to use Django + Postgresql on leopard?

2008-08-23 Thread Adi J. Sieker
On Sat, 23 Aug 2008 20:08:45 +0200, Theme Park Photo, LLC <[EMAIL PROTECTED]> wrote: > I have been unable to get Django + Postgres to run on Leopard. I have got that setup running here, using pure MacPorts. AFAIK, the python module ports are a little buggy and need > > (Works fine on Windows

Re: Is it possible to use Django + Postgresql on leopard?

2008-08-23 Thread Joshua Jonah
Just wanted to report, I have it setup using Fink, worked great. Theme Park Photo, LLC wrote: > I have been unable to get Django + Postgres to run on Leopard. > > (Works fine on Windows and Linux. Personally, I find it much easier to > get most open source stuff to run on Windows or

Re: Is it possible to use Django + Postgresql on leopard?

2008-08-23 Thread Jon Brisbin
I do *all* my development on OS X Leopard! I just used the version in MacPorts. You have to compile psycopg2 against the same architecture as the server libraries (64 or 32-bit, depending on what you're on). I use a MacBook Pro and I had to add the 64-bit flags. I was going to post what I

Re: FormWizard Problems

2008-08-23 Thread coulix
1. yes by overlriding the init class myForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(myForm, self).__init__(*args, **kwargs) self.fields.keyOrder = ['foo', 'bar',...] 2. in the same way you could use self.fields['foo'].label = self.fields['foo'].help_text On

Track usage

2008-08-23 Thread [EMAIL PROTECTED]
I need to track access to my Django based website. Is there a standard or recommended way of doing that? I don't need the tracking to be very complicated. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: HTML in ValidationError?

2008-08-23 Thread Tim Kersten
See http://www.djangoproject.com/documentation/templates/#automatic-html-escaping Tim ^,^ On Sat, Aug 23, 2008 at 12:04 PM, coan <[EMAIL PROTECTED]> wrote: > > > I try to do a raise forms.ValidationError('oh no'), but the > HTML tags are escaped when I render my form as {{ form }}. > Tried

Re: Track usage

2008-08-23 Thread Erik Allik
You can try Google Analytics at http://google.com/analytics/ You could develop a Django application for that, but I see no reason. Erik On 24.08.2008, at 2:01, [EMAIL PROTECTED] wrote: > > I need to track access to my Django based website. Is there a > standard or recommended way of doing

Re: Form validation

2008-08-23 Thread [EMAIL PROTECTED]
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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For

Re: Processing multiple forms in same page

2008-08-23 Thread Rodolfo
Just for curiosity, why would one have two forms in a single page? I don't think it is possible to submit the two in a shot. Maybe only of them is intended to be filled per access? []s Rodolfo On Aug 23, 4:38 pm, Archis <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I am new to Django. I have

Re: First App: devel server - can't establish a connection to 127.0.0.1

2008-08-23 Thread Jeff Anderson
Rob wrote: Not for me! :( I get a "Unable able to connect. Firefox cannot establish a connection to the server at 127.0.0.1:8000" message. I've searched the group messages and there are only a handful of (unrelated) messages about this. First question: are you really running the development

Re: Noob: form class location

2008-08-23 Thread Julien Phalip
The import is likely to be in your view: # views.py from forms import MyForm myview(request): if request.method == 'POST': form = MyForm(request.POST) ... That's assuming that views.py and forms.py are at the same level. Cheers, Julien On Aug 23, 11:25 pm, Gerard Petersen

Re: FormWizard Problems

2008-08-23 Thread lingrlongr
It looks like these ModelForms are going to work well for me. I have a lot less code now. I actually created 2 other classes to help out with the field ordering. I haven't tested these yet... class OrderedForm(ModelForm): def __init__(self, ordered_fields, *args, **kwargs):

Re: First App: devel server - can't establish a connection to 127.0.0.1

2008-08-23 Thread Erik Allik
"python manage.py runserver 0.0.0.0:8000" is always easier than looking up the IP address using ifconfig -- It simply listens on all IP addresses. :) Erik On 24.08.2008, at 4:13, Jeff Anderson wrote: > Rob wrote: >> Not for me! :( I get a "Unable able to connect. Firefox cannot >>

Re: First App: devel server - can't establish a connection to 127.0.0.1

2008-08-23 Thread Rob Erbaron
SOLVED. (and a followup question) I was running "python manage.py runserver" in a terminal, and then hit Ctrl-C... and then called up my Web browser. So, duh, I was shutting down the server in the terminal window and THEN browsing Jeesh. /shakes head/ Leaving the terminal window open,

Write Caching

2008-08-23 Thread Steve Potter
I am working on a project that involves logging every time an object is displayed, and I can have anywhere from tens to hundreds of objects displayed per page. So needless to say I can quickly be generating very large numbers of queries to the database to log all of these displays. What I am

Re: First App: devel server - can't establish a connection to 127.0.0.1

2008-08-23 Thread Rob
> First question: are you really running the development server on your > local box? Yes, definitely the local box. Well, let me clarify... I've got Python and Apache on the local box but my Apache Web root is actually on a share on another box (my file server). But I just point to /home/rob/

Re: Modify data before save?

2008-08-23 Thread Karen Tracey
On Sat, Aug 23, 2008 at 9:19 PM, Paddy Joy <[EMAIL PROTECTED]> wrote: > > What is the best way to modify form data before it is saved to the > database? > Generally this is done during cleaning/validation. > I have tried the following but can't seem to get it to work, can > anyone help? >

Re: First App: devel server - can't establish a connection to 127.0.0.1

2008-08-23 Thread Karen Tracey
On Sat, Aug 23, 2008 at 10:42 PM, Rob Erbaron <[EMAIL PROTECTED]>wrote: > > Next question: Is there a way to set up this development server as a > service so I don't have to start it from a terminal each time? > Each time what? It's a development server, expected to be used as you develop your

Re: pagination best practices

2008-08-23 Thread Juan Hernandez
any suggestions?? hehehe On Sat, Aug 23, 2008 at 7:35 PM, Juan Hernandez <[EMAIL PROTECTED]>wrote: > I have this very simple and primitive pagination method being called with > this instruction in urls.py > > ### > (r'^pyisp/menu/(\d+)/$', 'mail.views.menuPaginator'), > ### > > This is the

Re: pagination best practices

2008-08-23 Thread Karen Tracey
On Fri, Aug 22, 2008 at 8:05 PM, Juan Hernandez <[EMAIL PROTECTED]>wrote: > I have this very simple and primitive pagination method being called with > this instruction in urls.py > > [snipped] > Every time I hit something like domain/pyisp/menu/2 it shows the second > page of the QuerySet.

Re: pagination best practices

2008-08-23 Thread Juan Hernandez
> > > Using the Pagniator makes it so that when you hit the DB, the retrieved > results are limited to those relevant for the page you are displaying. You > are not reading the whole table and then tossing away everything except what > is on the page your are displaying, you are only reading from

Re: Modify data before save?

2008-08-23 Thread Paddy Joy
Thanks should have been more specific. Turns out it was a typo on my part, I should have had: def clean_password(self): instead of def clean_Password(self): Paddy On Aug 24, 2:19 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sat, Aug 23, 2008 at 9:19 PM, Paddy Joy

Re: pagination best practices

2008-08-23 Thread Karen Tracey
On Sun, Aug 24, 2008 at 1:23 AM, Juan Hernandez <[EMAIL PROTECTED]>wrote: > > So, let's say that everytime i get a page, the internat query to the db > just gets the, lets say, 10 rows that I requested? because I'm using > objects.all(). In that process, where is the DB being hit? > >

Re: pagination best practices

2008-08-23 Thread Juan Hernandez
I think I get it... domains = g.objects.all() just makes the QuerySet and paginator = ObjectPaginator(domains, 10) executes the query limiting the records to the one requested... Excellent Thanks for your help jhv On Mon, Aug 25, 2008 at 12:53 AM, Juan Hernandez <[EMAIL PROTECTED]>wrote: > >>

Re: pagination best practices

2008-08-23 Thread Juan Hernandez
Yep, thank you very much jhv On Mon, Aug 25, 2008 at 1:09 AM, Karen Tracey <[EMAIL PROTECTED]> wrote: > On Sun, Aug 24, 2008 at 1:23 AM, Juan Hernandez <[EMAIL PROTECTED]>wrote: > >> >> So, let's say that everytime i get a page, the internat query to the db >> just gets the, lets say, 10 rows