Re: formset initialization question

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 22:42 -0800, Margie wrote: > Hi Malcolm - Sorry, another formset question. Maybe you'll know the > answer offhand, have been trying to figure this out for awhile now. > I'm trying to set the initial value for a form field inside the > constructor for the form. The high leve

formset initialization question

2009-03-03 Thread Margie
Hi Malcolm - Sorry, another formset question. Maybe you'll know the answer offhand, have been trying to figure this out for awhile now. I'm trying to set the initial value for a form field inside the constructor for the form. The high level goal is to send out the 'tile' field as a hidden input

Re: formset of ModelForms missing functionality?

2009-03-03 Thread Margie
Yeah, I need to go back and review. I think my original problem was that I just didn't think about using extra to define the intial forms - I was thinking I needed a queryset. Your first resonse addressed that. But then you mentioned something about exclude and that made me think that maybe I c

Re: formset of ModelForms missing functionality?

2009-03-03 Thread Malcolm Tredinnick
On Wed, 2009-03-04 at 16:49 +1100, Malcolm Tredinnick wrote: > On Tue, 2009-03-03 at 21:44 -0800, Margie wrote: > > > > My model does have multiple fields in it - the Book thing was just an > > example to simplify. And I do have fields that I need to exclude. Am > > I not able to exclude fields

Re: formset of ModelForms missing functionality?

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 21:44 -0800, Margie wrote: > > My model does have multiple fields in it - the Book thing was just an > example to simplify. And I do have fields that I need to exclude. Am > I not able to exclude fields with the modelformset_factory? The example code I have showed field

Re: formset of ModelForms missing functionality?

2009-03-03 Thread Margie
My model does have multiple fields in it - the Book thing was just an example to simplify. And I do have fields that I need to exclude. Am I not able to exclude fields with the modelformset_factory? You reminded me that I could instead just set extra and use initial if necessary. However, I d

Re: [django] Re: never_cache and firefox

2009-03-03 Thread Ricardo Newbery
On Mar 3, 2009, at 6:20 PM, davathar wrote: > Ok, so I'm sure that I violated DRY and probably a few other good > programming principles, but here's what I did that worked and doesn't > alter the source. It's a hack, but I'm still learning. > > I created a new monkey_patches.py file and copied

Re: formset of ModelForms missing functionality?

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 20:21 -0800, Margie wrote: > I'm using formsets fairly successfully (thanks very much to Malcolm's > great quiz example), but it seems to me there is some functionality > missing.Say I create a formset of BookForms, where BookForm is a > ModelForm. The user will filleout

Re: Some help creating custom widgets...

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 20:01 -0800, mediumgrade wrote: > I am planning to create a series of widgets for Dojo. I just need a > little help getting started: > > First, I need to know how to set custom attributes in a widget. The > most important thing to set is "dojoType." For most widgets, I plan

formset of ModelForms missing functionality?

2009-03-03 Thread Margie
I'm using formsets fairly successfully (thanks very much to Malcolm's great quiz example), but it seems to me there is some functionality missing.Say I create a formset of BookForms, where BookForm is a ModelForm. The user will filleout the formset and for each form in the formset, when I rec

Some help creating custom widgets...

2009-03-03 Thread mediumgrade
I am planning to create a series of widgets for Dojo. I just need a little help getting started: First, I need to know how to set custom attributes in a widget. The most important thing to set is "dojoType." For most widgets, I plan to use the TextInput widget as my base. Secondly, I would like

Re: URL quoting and escaping

2009-03-03 Thread Graham Dumpleton
On Mar 4, 12:29 pm, Malcolm Tredinnick wrote: > On Tue, 2009-03-03 at 17:09 -0800, Rob Hudson wrote: > > At work we wanted to set up some quick clickthru tracking.  I whipped > > up a quick solution that seemed to work on my local machine.  The > > solution was to use jQuery to look for anchor

Re: never_cache and firefox

2009-03-03 Thread davathar
Ok, so I'm sure that I violated DRY and probably a few other good programming principles, but here's what I did that worked and doesn't alter the source. It's a hack, but I'm still learning. I created a new monkey_patches.py file and copied the function from the core file and altered it. Now I

Re: djWarehouse setting up

2009-03-03 Thread Justin Li
It looks cool even though it depends on many other components. I'm fighting to set it up by following the documentation. Thanks a lot! Justin On Mar 2, 11:03 am, Alex Gaynor wrote: > On Sun, Mar 1, 2009 at 9:07 PM, Justin Li wrote: > > > Hey Guys, > > > I'm setting up some online store for one

Re: never_cache and firefox

2009-03-03 Thread davathar
Thank you both for your responses. I don't know if you could tell, but I was a bit frustrated by the prior discussions on this not really addressing the root of the problem. I'm glad to know I'm not *just* crazy or overly picky. In the mean time I'll try to write a wrapper for the current funct

Re: URL quoting and escaping

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 17:09 -0800, Rob Hudson wrote: > At work we wanted to set up some quick clickthru tracking. I whipped > up a quick solution that seemed to work on my local machine. The > solution was to use jQuery to look for anchor tags who's href started > with "http://"; as a signifier

URL quoting and escaping

2009-03-03 Thread Rob Hudson
At work we wanted to set up some quick clickthru tracking. I whipped up a quick solution that seemed to work on my local machine. The solution was to use jQuery to look for anchor tags who's href started with "http://"; as a signifier of external links, and add a click event to them to direct th

Re: template blocks inside include?

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 16:00 -0800, Roy wrote: > Sorry for the lack of detail, by "not working" I mean that the > rendering to the child.html template shows "Place content here" which > is in the unnamed, dynamically included template, instead of the "My > content!" that I put in the content block

Re: never_cache and firefox

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 13:48 -0800, davathar wrote: > I'm using @never_cache as follows and IE7 has the correct behavior, > but Firefox 3.06 allows me to view the content of all previous pages > by clicking the back button even after going through a logout. [] > So, is this a feature waiting t

Re: Cookie problem on multiple sites

2009-03-03 Thread Ramiro Morales
On Tue, Mar 3, 2009 at 1:44 PM, Dids wrote: > > >> Then it's not working fine. > > What could explain the missing cookies then? I get them for FF. > Is there something "special" in IE that could explain the problem? Equip yourself with a network sniffer , or a debugging proxy, or a Firebug equiv

Re: Design Question - current item from a list of inventory

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 12:31 -0800, Tim wrote: > I have some models setup that allows users to have an inventory of > items: books and movies. These are setup as inherited models. > > What I would like to do is allow a user to select a current book and a > current movie, but only from "valid" opti

Re: Q search with foreign key

2009-03-03 Thread felix
use two underscores to address the other table/model institution_institution vs institution__institution django querysets rock ! On Tue, Mar 3, 2009 at 10:19 PM, Jesse wrote: > > I tried that option and received this error: > > Cannot resolve keyword 'institution_institution' into field

Re: Cookie problem on multiple sites

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 07:44 -0800, Dids wrote: > > > Then it's not working fine. > > What could explain the missing cookies then? I get them for FF. > Is there something "special" in IE that could explain the problem? I have absolutely no idea. IE certainly is "special" and we can only hope it

Re: Sorting via foreign key

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 06:56 -0800, Bela Hausmann wrote: > I've got two models: a Category model and a Message model. The Message > model has a timestamp 'time_created', by which the messages are sorted > per default. My problem is, that I want to make a list of categories > ordered by the time_cre

Re: Adding new attributes to objects in a query_set in custom Manager

2009-03-03 Thread Malcolm Tredinnick
On Tue, 2009-03-03 at 03:41 -0800, A Melé wrote: > I tried to add a custom attribute to the objects in the query_set of a > custom Manager before returning the query_set but it seems not to > work: > > class SongManager(models.Manager): > def expire(self): > from boto.s3.connection im

Re: Location of files that are part of my application

2009-03-03 Thread Kevin Teague
The __file__ attribute of a module can be used as a starting point for getting at data files within a python package. However, packages can be installed in zipped format, so if you need to account for this you can use the pkg_resources module in setuptools: http://peak.telecommunity.com/DevCenter

Re: template blocks inside include?

2009-03-03 Thread Roy
Sorry for the lack of detail, by "not working" I mean that the rendering to the child.html template shows "Place content here" which is in the unnamed, dynamically included template, instead of the "My content!" that I put in the content block of child.html. Basically the extended template (child

Re: global variables in stateless applications (was "Generating dynamic csv data")

2009-03-03 Thread GP
Tim, Thanks for your tip, I was able to maintain the correct value in the current session and retrieve it in the next request as you had suggested. This solved the issue of two different clients hitting the server as they have unique session_keys. An exception here is if I have two browsers open

Re: reason for working on a copy of POST object

2009-03-03 Thread Ishwor Gurung
Hi Alex, Alex Gaynor wrote: > On Tue, Mar 3, 2009 at 6:29 PM, Ishwor Gurung wrote: > >> Hi, >> >> What is the motive behind working on a copy of 'request.POST': >> e.g - >> if request.method == "POST": >>post = request.POST.copy() >> >> AFAIK, this implies making a copy of POST and workin

Re: reason for working on a copy of POST object

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 6:29 PM, Ishwor Gurung wrote: > Hi, > > What is the motive behind working on a copy of 'request.POST': > e.g - > if request.method == "POST": >post = request.POST.copy() > > AFAIK, this implies making a copy of POST and working on it. > Rather wouldn't it be faster i

reason for working on a copy of POST object

2009-03-03 Thread Ishwor Gurung
Hi, What is the motive behind working on a copy of 'request.POST': e.g - if request.method == "POST": post = request.POST.copy() AFAIK, this implies making a copy of POST and working on it. Rather wouldn't it be faster if we work on request.POST directly? : if request.method == "POST:

Cannot create model objects with file fields from shell

2009-03-03 Thread Brian Morton
I am having trouble getting this script to work. My intent is to load images into the db in bulk from the filesystem. http://pastebin.com/m40565da9 When I execute this, I get the following error: Traceback (most recent call last): File "load_images.py", line 16, in GalleryImage.objects.

Re: delete items in queryset results?

2009-03-03 Thread Ishwor Gurung
hello adrian wrote: > > I've got a table of species sightings. > I need a query that returns the latest sighting for each species. > I believe this would normally require GROUP BY but I > am trying to avoid raw SQL. > > Could I do the query without the GROUP BY, and then > modify the queryset re

Re: never_cache and firefox

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 4:48 PM, davathar wrote: > > I'm using @never_cache as follows and IE7 has the correct behavior, > but Firefox 3.06 allows me to view the content of all previous pages > by clicking the back button even after going through a logout. > > @never_cache > @login_required() > de

never_cache and firefox

2009-03-03 Thread davathar
I'm using @never_cache as follows and IE7 has the correct behavior, but Firefox 3.06 allows me to view the content of all previous pages by clicking the back button even after going through a logout. @never_cache @login_required() def search(request, search): Gmail has the correct behavior in f

Re: How to process a request with Content-Type: multipart/rfc-822 ?

2009-03-03 Thread Ville Säävuori
> > A helpful Djangonaut pointed out to me in IRC that I could subclass > > the request handler (in my case django.core.handlers.modpython) and do > > some magic to prevent the default handling from happening. Is this the > > only way to get to this data? I'd like a cleaner (and easier!) > > solut

Re: How to process a request with Content-Type: multipart/rfc-822 ?

2009-03-03 Thread Colin Bean
On Tue, Mar 3, 2009 at 2:36 PM, Ville Säävuori wrote: > > I'm playing with an web hook webapp called smtp2web ( http://smtp2web.com > ), which, as it name suggests, forwards email messages to a URL as a > http POST request. > > A quote from docs: "the entire message (including headers) is sent in

Re: Using variables with object.filters

2009-03-03 Thread dj
It worked !!! My apologies, that was probably a no brainier for you, but I for the life of me could not figure it out. I am still quite GREEN. Thanks a bunch :-)!!! On Mar 3, 4:04 pm, Alex Gaynor wrote: > On Tue, Mar 3, 2009 at 5:01 PM, dj wrote: > > > I have a list of objects : ships= [, > F

How to process a request with Content-Type: multipart/rfc-822 ?

2009-03-03 Thread Ville Säävuori
I'm playing with an web hook webapp called smtp2web ( http://smtp2web.com ), which, as it name suggests, forwards email messages to a URL as a http POST request. A quote from docs: "the entire message (including headers) is sent in a POST request to the URL you specified, with Content-Type: multi

Re: Is ODBC supported so to use DB's like Access, Teradata?

2009-03-03 Thread Jeff Anderson
KG wrote: > What needs to be done to make use of any other DB engine thru ODBC? > An ODBC database backend would need to be written for the Django ORM. signature.asc Description: OpenPGP digital signature

Re: Using variables with object.filters

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 5:01 PM, dj wrote: > > I have a list of objects : ships= [, Freeman> ,] > > Each ship object has these attributes with an associated value: > name Hi Ialakai > abbrWTEY > ship Hi Ialakai > cruise Dune > slug dune-wtey > > Given a variable containing the name of an

Re: Location of files that are part of my application

2009-03-03 Thread Jack Orenstein
Sorry, I was unclear. I don't mean that these files contain python source code. They contain text that I want to read from certain requests to my app. So the question is where to put the files (under the app directory I assume), and how to refer to them using a relative path, or how I can

modelform bound to an instance - imagefield issues

2009-03-03 Thread uno...@gmail.com
I have a model which has an imagefield. I have a modelform which uses this model and in case of editing, uses the instance to populate the form fields. While the other fields (like charfield, textfield etc.) get populated with the instance values correctly, is there any way I can show the image

Using variables with object.filters

2009-03-03 Thread dj
I have a list of objects : ships= [, ,] Each ship object has these attributes with an associated value: name Hi Ialakai abbrWTEY ship Hi Ialakai cruise Dune slug dune-wtey Given a variable containing the name of an attribute in the object (EX: field=cruise) and the value they are search

Re: session vars or User in templatetags

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 4:57 PM, Bobby Roberts wrote: > > > on my template i have: > > > > {% au.id|getbidstatus %} > > > > if i try {% au.id|getbidstatus(request.user.id) %}, I get this: > > > > Could not parse the remainder: '(request.user.id)' from 'au.id| > > getbidstatus(request.user.id)' >

Re: Location of files that are part of my application

2009-03-03 Thread Briel
Django makes python aware of your app folder when you install the app so you can just do: from appname.resources.filename import function That should work whenever your app is propperly installed. On 3 Mar., 21:41, Jack Orenstein wrote: > I have a small number of files that need to be accessib

Re: session vars or User in templatetags

2009-03-03 Thread Bobby Roberts
> on my template i have: > > {% au.id|getbidstatus %} > > if i try {% au.id|getbidstatus(request.user.id) %},  I get this: > > Could not parse the remainder: '(request.user.id)' from 'au.id| > getbidstatus(request.user.id)' ok ... I'M LOOKING AT THE DOCS and i'm closer but it's only doing the l

Leopard Server Deployment

2009-03-03 Thread dononyx
I am a newbie and like django do far but does anyone know where there is a step-by-step example of a django - leopard server 10.5 server setup. I tried doing this myself and I am not a great "deployer" of software. Any help appreciated. --~--~-~--~~~---~--~~ You re

Re: session vars or User in templatetags

2009-03-03 Thread Bobby Roberts
> You need to pass request.user.id to the templatetag, nothing automatically > has access to the current user or the current request. hi alex - on my template i have: {% au.id|getbidstatus %} if i try {% au.id|getbidstatus(request.user.id) %}, I get this: Could not parse the remainder: '(req

Re: session vars or User in templatetags

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 4:17 PM, Bobby Roberts wrote: > > I need to be able toaccess request.user.id in a template tag. Here > is what i'm importing: > > > from django import template > from django.contrib.auth.models import User > from django.template.defaultfilters import stringfilter > impor

Re: Q search with foreign key

2009-03-03 Thread Jesse
I tried that option and received this error: Cannot resolve keyword 'institution_institution' into field However, I think I may have it. I used this statement: qset2 = ( Q(institution__icontains=queryr) ) resultsi = Institution.objects.filter(qset2).distinct()

session vars or User in templatetags

2009-03-03 Thread Bobby Roberts
I need to be able toaccess request.user.id in a template tag. Here is what i'm importing: from django import template from django.contrib.auth.models import User from django.template.defaultfilters import stringfilter import time,datetime from auctions.models import Bid,Auction,AuctionFAQ,Bid

Re: Q search with foreign key

2009-03-03 Thread Tim
If you want to look up an Institution using the Project model, you should be able to use "institution__institution__icontains" --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

Re: form object created with empty _meta

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 3:54 PM, nivhab wrote: > > > As far as I know you can't use django ModelForms with google app > engine. > > Google provides a "djangoforms" module in which the copy-paste much of > the ModeForm functionality adjusted to their meta-model (see > http://code.google.com/appeng

Re: form object created with empty _meta

2009-03-03 Thread nivhab
> As far as I know you can't use django ModelForms with google app engine. Google provides a "djangoforms" module in which the copy-paste much of the ModeForm functionality adjusted to their meta-model (see http://code.google.com/appengine/articles/djangoforms.html) so it should work. Furthermo

Q search with foreign key

2009-03-03 Thread Jesse
I have a Project model with a foreign key to institution. I want to do a Q(institution_icontains)=queryr on the institution field in the institution table, but the filter needs to go through the Projects model. I need all institutions associated with a Project. class Project(models.Model):

Location of files that are part of my application

2009-03-03 Thread Jack Orenstein
I have a small number of files that need to be accessible to my Django application. These are part of the application, and so should be treated as source code. The question is where to put them? Putting them under MEDIA_ROOT doesn't seem right. They go with the application so they should b

Re: Design Question - current item from a list of inventory

2009-03-03 Thread Tim
Easier to read models: http://pastebin.com/fa00be87 --~--~-~--~~~---~--~~ 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 gro

Re: form object created with empty _meta

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 3:31 PM, nivhab wrote: > > Here's the form class. > Thanks, Yaniv > > > --- > from busa.models import User > from django.utils.translation import ugettext_lazy as _ > from django import

Design Question - current item from a list of inventory

2009-03-03 Thread Tim
I have some models setup that allows users to have an inventory of items: books and movies. These are setup as inherited models. What I would like to do is allow a user to select a current book and a current movie, but only from "valid" options in that user's inventory. What I mean by valid is th

Re: form object created with empty _meta

2009-03-03 Thread nivhab
Here's the form class. Thanks, Yaniv --- from busa.models import User from django.utils.translation import ugettext_lazy as _ from django import forms class UserForm(forms.ModelForm): """ A form that

Re: form object created with empty _meta

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 3:18 PM, nivhab wrote: > > Hi, > > I am using django on google app engine, and also using the app-engine- > patch package. > I am getting this error when trying to save a form: > > Exception Value:'NoneType' object has no attribute 'properties' > Exception Location:

form object created with empty _meta

2009-03-03 Thread nivhab
Hi, I am using django on google app engine, and also using the app-engine- patch package. I am getting this error when trying to save a form: Exception Value:'NoneType' object has no attribute 'properties' Exception Location: \Development\google_appengine\google\appengine\ext \db\dja

Re: Creating a Symbolic Link using Windows

2009-03-03 Thread Sergio Durand
snaggz03 escreveu: > Thanks, Sergio. I have now confirmed that dajngo-admin.py is located > in C:\Python2.6\Scripts . So the symlink wasn not what was keepig my > admin site from working properly or at all. I was following along > with the django tutorial from www.djangoproject.com , modifying i

Re: Creating a Symbolic Link using Windows

2009-03-03 Thread snaggz03
Thanks, Sergio. I have now confirmed that dajngo-admin.py is located in C:\Python2.6\Scripts . So the symlink wasn not what was keepig my admin site from working properly or at all. I was following along with the django tutorial from www.djangoproject.com , modifying it to my own project as I we

delete items in queryset results?

2009-03-03 Thread adrian
I've got a table of species sightings. I need a query that returns the latest sighting for each species. I believe this would normally require GROUP BY but I am trying to avoid raw SQL. Could I do the query without the GROUP BY, and then modify the queryset results using Python to eliminate rows

Re: Using BaseInlineFormSet with customized form

2009-03-03 Thread koenb
On 3 mrt, 14:32, koenb wrote: > Do you think this is worth a ticket ? I created ticket #10403 for this. Koen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email t

Re: Trouble overriding UserAdmin

2009-03-03 Thread Brandon Taylor
Hi Alex, Actually, the 'user_profile' app is the last one in my list. I can't explain why it works on a previously developed site using Django trunk and not this one. Brandon On Mar 3, 11:54 am, Alex Gaynor wrote: > On Tue, Mar 3, 2009 at 12:41 PM, Brandon Taylor > wrote: > > > > > > > Hi eve

Re: Creating a Symbolic Link using Windows

2009-03-03 Thread Sergio Durand
Hi, snaggz03 escreveu: > I am attempting to create a database using django on a server which I > did not create so... I was told Python was set up on the server. How > do I determine if djano-admin.py is on my system path? If it is not, > then how do I go about "symlinking to django-admin.py f

Re: global variables in stateless applications (was "Generating dynamic csv data")

2009-03-03 Thread GP
> This is bound to fail when user A hits view #1, then user B hits > view #1 (overwriting A's global), then user A hits view #2, > seeing B's results. Yep, figured that out the hard way > your views should be fairly stateless, relying only on > information coming from the user -- whether stored

Re: Generating dynamic csv data

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 12:54 PM, GP wrote: > > > What you want to do is abstract the machinery that creates the queryset > into > > a seperate function, that way you can take the GET vars in both functions > > and get a queryset from them. FWIW I've been working on a project to do > > something

Re: Trouble overriding UserAdmin

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 12:54 PM, Alex Gaynor wrote: > > > On Tue, Mar 3, 2009 at 12:41 PM, Brandon Taylor > wrote: > >> >> Hi everyone, >> >> Not sure what's up here, the same code works on another site. >> Basically what I'm doing is adding an inline model form to the User >> change form... >>

Re: Trouble overriding UserAdmin

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 12:41 PM, Brandon Taylor wrote: > > Hi everyone, > > Not sure what's up here, the same code works on another site. > Basically what I'm doing is adding an inline model form to the User > change form... > > from django.db import models > from django.contrib import admin > fro

Re: Generating dynamic csv data

2009-03-03 Thread GP
> What you want to do is abstract the machinery that creates the queryset into > a seperate function, that way you can take the GET vars in both functions > and get a queryset from them.  FWIW I've been working on a project to do > something similar here:http://github.com/alex/django-filter/tree/m

Trouble overriding UserAdmin

2009-03-03 Thread Brandon Taylor
Hi everyone, Not sure what's up here, the same code works on another site. Basically what I'm doing is adding an inline model form to the User change form... from django.db import models from django.contrib import admin from django.contrib.auth.models import User from django.contrib.auth.admin i

Creating a Symbolic Link using Windows

2009-03-03 Thread snaggz03
I am a beginner so bear with me here. Given this from the django tutorial, "django-admin.py should be on your system path if you installed Django via python setup.py. If it’s not on your path, you can find it in site- packages/django/bin, where `site-packages` is a directory within your Python i

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 11:46 AM, Ross wrote: > > As I thought about it more, I came up with something similar to what > both of you suggested. Django's query language has made my SQL > knowledge suffer a bit--your explanation about why the limit won't > work makes sense, Jeff. > > Thanks a lot fo

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Ross
As I thought about it more, I came up with something similar to what both of you suggested. Django's query language has made my SQL knowledge suffer a bit--your explanation about why the limit won't work makes sense, Jeff. Thanks a lot for the suggestions. On Mar 3, 10:39 am, Jeff FW wrote: > T

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Jeff FW
This time I didn't, apparently, read what you wanted exactly. Here I was, talking about sums, when all you want are the minimum and maximum. Apparently, I shouldn't answer mailing lists in the morning. Anyway, *most* of what I said holds true, as min and max work pretty much the same way as sum

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Jeff FW
Responded too quickly :-) If you're already getting a list of the top 100 products (and displaying them, I assume, in a loop,) then totalling up the prices in Python really won't hurt at all. I'd only suggest going with my *previous* suggestion if you *weren't* already fetching the top 100 produ

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 11:32 AM, Ross wrote: > > Do you know a good way to do what I am trying to do? I can write a > quick for loop to do the work, but I was hoping to offload some of the > work to the database since it is much faster than a Python for loop. > > I have a set of say 10,000 Produc

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Jeff FW
The behavior is there because you can't limit an aggregate function in (AFAIK) SQL in that way. It just doesn't make sense--what would this actually mean? select sum(price) from product limit 100; Really, you'd be limiting the number of *rows* of sum returned, which, unless you're using GROUP,

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Ross
Do you know a good way to do what I am trying to do? I can write a quick for loop to do the work, but I was hoping to offload some of the work to the database since it is much faster than a Python for loop. I have a set of say 10,000 Product models. I want to get a list of the 100 with the highes

Re: ManyToOne : cannot form a proper query :(

2009-03-03 Thread [CPR]-AL.exe
Ooops, mean "How", not "Who" ... srry... --~--~-~--~~~---~--~~ 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 em

Re: ManyToOne : cannot form a proper query :(

2009-03-03 Thread [CPR]-AL.exe
Mean, "two reporters", of course --~--~-~--~~~---~--~~ 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

Re: ManyToOne : cannot form a proper query :(

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 11:13 AM, [CPR]-AL.exe wrote: > > for example, i have this models: > (like here: http://www.djangoproject.com/documentation/models/many_to_one/ > ) > > > from django.db import models >

ManyToOne : cannot form a proper query :(

2009-03-03 Thread [CPR]-AL.exe
for example, i have this models: (like here: http://www.djangoproject.com/documentation/models/many_to_one/) from django.db import models class Reporter(models.Model): first_name = models.CharField(max_le

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 8:55 AM, Ross wrote: > > I have started using aggregation, but it seems to ignore any slicing I > do on a QuerySet before calling aggregate. This is what I'm doing: > > Product.objects.order_by("-price")[:100].values("price").aggregate(Max > ("price"), Min("price")) > > I w

extending admin change_form template

2009-03-03 Thread Jon Reck
I'm a novice Python and Django programmer so please don't assume a lot of knowledge here. I'm trying to place a link on an admin change form to a label printing function. I'd like to pass the id of the current record to the function. If I hardwire it in (see below- record number = 920) it works. I

Re: template blocks inside include?

2009-03-03 Thread Alex Robbins
Roy, I'd love to help but I don't think I understand the problem (and I am too lazy to set up the inheritance chain myself). You say it seems not to work? When does it fail? Try putting a little content into each template (maybe the template's name, in an h1 tag). Then how far does the rendering

Re: Cookie problem on multiple sites

2009-03-03 Thread Dids
> Then it's not working fine. What could explain the missing cookies then? I get them for FF. Is there something "special" in IE that could explain the problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dja

Re: template error

2009-03-03 Thread Alex Robbins
It looks like your problem is probably on line 2. The {% comment_form_target %} tag is trying to do a reverse url lookup. However, there aren't any matches in your url conf. Hopefully, you just forgot to set up a url for post_comment. Unfortunately, what that usually means for me is that there is

Sorting via foreign key

2009-03-03 Thread Bela Hausmann
I've got two models: a Category model and a Message model. The Message model has a timestamp 'time_created', by which the messages are sorted per default. My problem is, that I want to make a list of categories ordered by the time_created date of the newest message in every category. Anyboy can he

Re: Why do some shared hosting providers support Django and others don't?

2009-03-03 Thread Wiiboy
Correction: I paid in advance for my current hosting provider, two years, and its only been 6 months. I can't be possibly be worth 18 months of wasted hosting. Thanks anyway, though. So long as my site still exists and I'm still using Python, I'll be reading this again in a year and a half. --~

Re: Why do some shared hosting providers support Django and others don't?

2009-03-03 Thread Chris Scott
On Mar 2, 2009, at 6:51 PM, James Bennett wrote: > > On Mon, Mar 2, 2009 at 6:25 PM, Wiiboy wrote: >> I'm with a shared hosting company called Lunarpages. They tell me >> Django, by itself, even with Fast CGI, because it is a framework, is >> too resource intensive for them to allow. But many

Aggregating Ignores Slicing?

2009-03-03 Thread Ross
I have started using aggregation, but it seems to ignore any slicing I do on a QuerySet before calling aggregate. This is what I'm doing: Product.objects.order_by("-price")[:100].values("price").aggregate(Max ("price"), Min("price")) I want the maximum and minimum price for the products with the

Re: Using BaseInlineFormSet with customized form

2009-03-03 Thread koenb
On 3 mrt, 14:09, Alex Gaynor wrote: > > AFAIK the intention was always to eventually have a metaclass so it looked > more like model forms, but the usecase wasn't as strong, and no one who > wanted it ever wrote any code AFAIK > > Alex Thank you Alex, something like this seems to work: class

Re: Using BaseInlineFormSet with customized form

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 8:01 AM, koenb wrote: > > Hi all, > > I want to use a inlineformset with a highly customized form (it is > based on a specific metaclass and has a customized __init__ function). > > Due to the way the inlineformset_factory function works, if I specify > my form in the form

Re: Ignore Case Sensitive Property

2009-03-03 Thread Alex Gaynor
2009/3/3 Daniel Roseman > > On Mar 3, 9:50 am, burcu hamamcıoğlu wrote: > > I wrote a query like : applications = > > Application.objects.filter(name__contains=searchText) > > I want to get the applications filtered by searchText. If the app. name > is > > "Guitar" and my serachText is "guitar",

Re: Generating dynamic csv data

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 2:00 AM, GP wrote: > > I have a view which generates a table (table_view) of the most recent > entries entered in the Test table of the database. I have the option > of querying the database and render the table based on the user > criteria as well > > Something like this:

  1   2   >