Re: HttpResponse, slow on apache

2010-03-22 Thread TheIvIaxx
i checked out the toolbar, and i have a butt load of queries. Not for everything on the site, but for this particular page there are 300+ queries. They are small and are less than 1ms. I'll try to get this better :) However, in regards to Xaviers point, yes I'm sure all DB stuff has been done.

Re: HttpResponse, slow on apache

2010-03-22 Thread Xavier Ordoquy
Hi, I'm not sure you give enough details or evidences on HttpResponse being slow. Are you 100% sure that DB access have been made ? Don't forget query sets are lazy, ie database accesses are not done when you define your queryset. I got a website with something like 4 (small) DB queries. Without

Re: HttpResponse, slow on apache

2010-03-22 Thread Daniel Roseman
On Mar 22, 11:41 pm, TheIvIaxx wrote: > im not about to say my code is prefect :)  I'll check out the toolbar > thing. > > my problem though is that timing it to the point where it's completely > out of my hands is .72 sec and then my browser doesn't get byte #1 > until 1.46 sec.  There is a big d

Re: Permissions for groups and users

2010-03-22 Thread Tim Shaffer
SVN diff is here: http://code.google.com/p/django-namespace/source/diff?spec=svn3&r=3&format=side&path=/trunk/namespace/admin.py&old_path=/trunk/namespace/admin.py&old=2 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, sen

Re: Permissions for groups and users

2010-03-22 Thread Tim Shaffer
Ah, yes I see the problem. Good catch. I hadn't tested that functionality. Luckily it is a simple change to admin.py. It's a matter of removing line 25: form.base_fields["namespace"].queryset = Namespace.objects.user_can_access(request.user) And replacing it with the following 3 lines. This basic

[bug?] using GeoManager in subqueries gives no results (Django 1.2 beta 1) + 1.1.1 bug

2010-03-22 Thread Marcin Kałuża
Hi, I'ts my first post here, so "Hello" Everyone :) I've got the code as shown below. The problem is that when I do a subquery using a previously generated queryset it doesn't return any results, if the queryset contained a geometry field (r1 here) >>> b="49.98544839116778,19.8248291015625,50.1439

Re: HttpResponse, slow on apache

2010-03-22 Thread TheIvIaxx
im not about to say my code is prefect :) I'll check out the toolbar thing. my problem though is that timing it to the point where it's completely out of my hands is .72 sec and then my browser doesn't get byte #1 until 1.46 sec. There is a big discrepancy and i'm not sure what is causing it. T

Re: HttpResponse, slow on apache

2010-03-22 Thread Daniel Roseman
On Mar 22, 11:25 pm, TheIvIaxx wrote: > Not sure whose jurisdiction this falls under, but from my findings, > this is what i have: > > Firebug reports 1.46/.055 sec waiting/downloading.  I need the > "waiting" part to be less than 1 sec. > > It looks like sending the response is very fast, but pre

HttpResponse, slow on apache

2010-03-22 Thread TheIvIaxx
Not sure whose jurisdiction this falls under, but from my findings, this is what i have: Firebug reports 1.46/.055 sec waiting/downloading. I need the "waiting" part to be less than 1 sec. It looks like sending the response is very fast, but preparing it is not. So i investigated as to where th

Re: What validation tests are applied to ImageField?

2010-03-22 Thread john2095
Thanks Tom. I don't know where it comes from but it seems deeply ingrained for me to expect the model to enforce the atomicity/ integrity of its objects. Just for anyone who stumbles over this thread and wants to know how it ends... In this application I'm not using a form (uploadify is a flash-

Re: Permissions for groups and users

2010-03-22 Thread Sven Richter
Hi Tim, I just tried your app and, wow, this is exactly what i was looking for. It works instantly, but, as always, there must be a but. One thing doesnt work. I did all as you said, and, like i wrote, it worked out of the box, except my ForeignKeys. In my example i have: class Task(NamespacedMod

Re: Negate querysets

2010-03-22 Thread Tim Shaffer
It depends. This will only run one query, when negated_queryset is used. queryset = User.objects.filter(first_name='vinicius') negated_queryset = User.objects.exclude(id__in=queryset.values("id")) Since the first queryset is not evaluated until it's used in the negated_queryset (as a subquery).

Re: Issue with aggregate_select changes

2010-03-22 Thread David Cramer
I suppose I should post the full version, since my simplified attempt didnt work :) class ICount(Aggregate): name = 'ICOUNT' sql_function = 'COUNT' sql_template = '%(function)s(LOWER(%(field)s))' is_ordinal = True def __init__(self, lookup, **extra): self.lookup = look

Re: Remove session on browser close

2010-03-22 Thread Paulo Almeida
Maybe I'm missing something obvious, but can't you pass the user to the template and use: {% if user.is_authenticated %} instead of: {% if form.thanks %} It doesn't solve the problem of logging out, but you don't have to handle the session manually. - Paulo On Mon, Mar 22, 2010 at 9:40 PM, gr

Re: Negate querysets

2010-03-22 Thread Matt Schinckel
On Mar 23, 6:17 am, Phlip wrote: > > Just create another queryset that excludes everything in your first > > queryset: > > > negated_queryset = User.objects.exclude(id__in=queryset.values("id")) > > QuerySets are already so easy to plug-n-play... Ain't there a way to > do it without whacking the d

Issue with aggregate_select changes

2010-03-22 Thread David Cramer
One of the recent changes in trunk was a change to how querysets were cloned. Due to this, some old code we had is no longer working. This was a custom aggregate which relied on "aggregate_select" (see below). I believe the change I'm referring to is what is causing this, and I'm unsure of what the

Re: Remove session on browser close

2010-03-22 Thread john2095
I think the proper paradigm is to use the AnonymousUser. Rather than trying to destroy the session - something that cannot be reliably achieved - instead set the user of the session back to AnonymousUser and test/react to that. On Mar 23, 8:40 am, grimmus wrote: > Basically all i want to do is

Re: Remove session on browser close

2010-03-22 Thread grimmus
Basically all i want to do is the following : Have a newsletter signup form. When the user signs up successfully the area where the form was has a thanks message instead of the form. The form or thanks message is displayed on every page of the site, so I thought using a session would be the best

Re: Permissions for groups and users

2010-03-22 Thread Tim Shaffer
Django doesn't support that out of the box. I searched and couldn't find anything. Self plug: I created an app that does exactly this. http://code.google.com/p/django-namespace/ Only difference is I called the model Namespace instead of Domain. Just download it, then add it to your INSTALLED_APPS

Permissions for groups and users

2010-03-22 Thread Sven Richter
Hi, this might be offtopic, so i excuse for that in advance, but i dont know a better place to ask for it, cause its not completely offtopic at all. Let's start with what i want to achieve. I am building some sort of a groupware, and i want it to fully support different domains, and with it diffe

Re: Trouble installing satchmo

2010-03-22 Thread Jonathan Hayward
Thank you, Andrew and Laszlo. On Mon, Mar 22, 2010 at 3:17 PM, Laszlo Antal wrote: > Hi, > > I use this installation and it works. > http://bitbucket.org/chris1610/satchmo/wiki/ImprovedInstallationProcess > > Hope > it help

Re: Negate querysets

2010-03-22 Thread Tim Shaffer
Might be possible. I'm not terribly familiar with the innards of the QuerySet class. Seems like it could get real complex real fast, especially if you're using Q objects. On Mar 22, 4:17 pm, Phlip wrote: > > Just create another queryset that excludes everything in your first > > queryset: > > > n

Re: Negate querysets

2010-03-22 Thread Phlip
> Just create another queryset that excludes everything in your first > queryset: > > negated_queryset = User.objects.exclude(id__in=queryset.values("id")) QuerySets are already so easy to plug-n-play... Ain't there a way to do it without whacking the database twice? -- Phlip http://c2.com/cg

Re: Trouble installing satchmo

2010-03-22 Thread Laszlo Antal
Hi, I use this installation and it works. http://bitbucket.org/chris1610/satchmo/wiki/ImprovedInstallationProcess Hope it helps lzantal On Mon, Mar 22, 2010 at 12:14 PM, Andrew wrote: > Go to: > http://groups.google.co

Re: Negate querysets

2010-03-22 Thread Tim Shaffer
Just create another queryset that excludes everything in your first queryset: negated_queryset = User.objects.exclude(id__in=queryset.values("id")) On Mar 22, 3:47 pm, Vinicius Mendes wrote: > Is there any way to negate a queryset? Let's supose i have this queryset: > > User.objects.filter(first

Negate querysets

2010-03-22 Thread Vinicius Mendes
Is there any way to negate a queryset? Let's supose i have this queryset: User.objects.filter(first_name='vinicius') and I want to have the queryset with the objects that is not in first queryset. I know I can do this: User.objects.exclude(first_name='vinicius') But we have cases where we don't

Re: Trouble installing satchmo

2010-03-22 Thread Andrew
Go to: http://groups.google.com/group/satchmo-users On 15 мар, 20:10, Jonathan Hayward wrote: > I'm trying to get satchmo up and running from the instructions > athttp://bitbucket.org/chris1610/satchmo/downloads/Satchmo.pdf, and when I > get to 2.1.3 (installing PIL manually as a workaround), th

Easily creating custom pages for django.contrib.admin

2010-03-22 Thread Grigory Javadyan
Greetings! I had been playing around with Django for a while and eventually a question arised: is there any way to easily (by "easily" I mean, without sub-classing AdminSite) create a custom page for Django's admin site? Let me clarify my question by an example. Suppose you have an app that s

Re: Dynamic multi-site - running many sites from one Django instance

2010-03-22 Thread Tim Shaffer
It gives you multiple sites from one codebase with multiple settings files. They are using the same project module. So your project would look like this: project - app1 - app2 - settings.py - settings_site1.py - settings_site2.py - urls.py settings.py would contain all the settings like a normal

Is it possible to change the width of the boxes displayed by the filter_horizontal in Django admin interface?

2010-03-22 Thread rc
I am using the filter_horizontal in my Django admin interface and it works great. Only problem is that some of the data that is contained in the manytomany relationship is longer than the filter_horizontal forms in the admin interface. How do I change the _width_ of the forms displayed. >From look

Re: Dynamic multi-site - running many sites from one Django instance

2010-03-22 Thread Tom Evans
On Mon, Mar 22, 2010 at 5:03 PM, Tim Shaffer wrote: > How are you serving the Django project? Are you using Apache? > mod_python? mod_wsgi? > > If you are using mod_python or mod_wsgi, you should be able to change > the DJANGO_SETTINGS_MODULE for each site. So basically for each site, > you would

Django in sub

2010-03-22 Thread Vnuce
Hi there, first post in this group and a Django newbie, so please, be gentle :) I have two problems I failed to solve on my own, so I'm hoping for a help from you guys... Problem 1: If I go to address http://foo.com/django (without trailing slash) I get an Internal Server Error. Log shows this in

Re: Dynamic multi-site - running many sites from one Django instance

2010-03-22 Thread Tim Shaffer
How are you serving the Django project? Are you using Apache? mod_python? mod_wsgi? If you are using mod_python or mod_wsgi, you should be able to change the DJANGO_SETTINGS_MODULE for each site. So basically for each site, you would have a separate settings file in your project. So for the first

Re: hidden fields not cleaned

2010-03-22 Thread Bjunix
Django validates form data in this order when calling is_valid or full_clean: 1. run the clean method of the form field itself. Here: DateTimeField.clean() 2. then run the clean_() method of the form if available 3. once those two methods are run for every field, run the clean() method of the form

Re: Strings in page in []

2010-03-22 Thread serek
Hi You have right. Thanks you very mach!!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.

Re: Event more complicated forms / templates

2010-03-22 Thread Paulo Almeida
You could use inline formsets (have CustomerContactAnswer be a formset of CustomerContactQuestion) and then render the Answer forms as a table in the template. - Paulo On Mon, Mar 22, 2010 at 1:31 PM, ALJ wrote: > Is there any to have a table type form will variable rows and columns? > > I have

hidden fields not cleaned

2010-03-22 Thread gentlestone
this piece of code leads to Key error 'some_hidden_field' class XyForm(Form): some_hidden_field = forms.DateTimeField(widget=forms.HiddenInput()) def clean(self): some_hidden_field = self.cleaned_data['some_hidden_field'] Why are hidden fields not cleaned? I need to validate the

Re: Remove session on browser close

2010-03-22 Thread Bill Freeman
And if the user disables javascript, or kills the browser without normal exit, or loses his connection, or pulls the ethernet cable, or has a power failure? On Mon, Mar 22, 2010 at 10:06 AM, Wiiboy wrote: > Couldn't you use Javascript for this? For example, on the > onbeforeunload event, delete t

Re: Remove session on browser close

2010-03-22 Thread Wiiboy
Couldn't you use Javascript for this? For example, on the onbeforeunload event, delete the sessionid cookie? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from

Event more complicated forms / templates

2010-03-22 Thread ALJ
Is there any to have a table type form will variable rows and columns? I have events. For each event there might be several appointment days. And a set of questions to measure how many people the rep had contact with. My expected form output would be something like: Question,

Creating sample users for testing

2010-03-22 Thread Ivan Uemlianin
Dear All I'd like to create a bunch of sample users for testing a django website. I was going down the road of using an initial_data fixture, but there seem to be a couple of problems with this: - Can I supply partial data in initial_data, i.e. only auth.user info (at the moment, username and pa

Re: Arrays

2010-03-22 Thread bruno desthuilliers
On Mar 22, 12:19 pm, James wrote: > Hi, > > I am struggling to get a piece of code working. > I've looked at it too much and now can't see what im doing wrong. > > Anyone have any ideas? The error is as follows: > Type Error > string indices must be integers - (if ids['m'['manufacturer__id']] "'m

Re: Arrays

2010-03-22 Thread James
Hi, Thanks for this, it's helped me a lot. I will see if I can muddle through the next part. My my had just gone completely blank with this. Going to get some fresh air first. Thanks again! --- On 22 Mar, 11:38, Daniel Roseman wrote: > On Mar 22, 11:19 am, James wrote: > > > > > Hi, > > > I

Re: Arrays

2010-03-22 Thread Daniel Roseman
On Mar 22, 11:19 am, James wrote: > Hi, > > I am struggling to get a piece of code working. > I've looked at it too much and now can't see what im doing wrong. > > Anyone have any ideas? The error is as follows: > Type Error > string indices must be integers - (if ids['m'['manufacturer__id']] is >

Re: Remove session on browser close

2010-03-22 Thread Tom Evans
On Mon, Mar 22, 2010 at 11:17 AM, grimmus wrote: > Hi, > > I have a simple newsletter signup form. If the user submits the form > and there are no errors then i set the session: > > request.session['signed_up'] = True > > Then, for all other page requests i check if the session exists > >        

Re: Tagging - Extending by adding a rating?

2010-03-22 Thread Paulo Almeida
I know django-tagging has the Tag model and the TaggedItem model. I wonder if it would be possible to create the Many to Many relationship between your Articles and this TaggedItem model, through a Ratings intermediary table. I have no idea if that would work (and keep all the django-tagging featur

Arrays

2010-03-22 Thread James
Hi, I am struggling to get a piece of code working. I've looked at it too much and now can't see what im doing wrong. Anyone have any ideas? The error is as follows: Type Error string indices must be integers - (if ids['m'['manufacturer__id']] is not m['manufacturer__id']: ) Code: tmp_manufactu

Remove session on browser close

2010-03-22 Thread grimmus
Hi, I have a simple newsletter signup form. If the user submits the form and there are no errors then i set the session: request.session['signed_up'] = True Then, for all other page requests i check if the session exists if request.session.get('signed_up', True): for

Re: Primary key in queryset even when using only()

2010-03-22 Thread Kevin Renskers
Thank you very much, this works perfectly! On Mar 22, 12:01 pm, bruno desthuilliers wrote: > On 22 mar, 11:08, Kevin Renskers wrote: > > > Hi, > > > I am using a combination of the only() and distinct() functions on a > > model to get the unique values of one column. Sadly, the only() > > functi

Re: Primary key in queryset even when using only()

2010-03-22 Thread bruno desthuilliers
On 22 mar, 11:08, Kevin Renskers wrote: > Hi, > > I am using a combination of the only() and distinct() functions on a > model to get the unique values of one column. Sadly, the only() > function also includes the primary key (even though I only give one > column name), which has the effect that

Primary key in queryset even when using only()

2010-03-22 Thread Kevin Renskers
Hi, I am using a combination of the only() and distinct() functions on a model to get the unique values of one column. Sadly, the only() function also includes the primary key (even though I only give one column name), which has the effect that all rows are seen as unique. This is the result I wa

Re: What validation tests are applied to ImageField?

2010-03-22 Thread Tom Evans
On Mon, Mar 22, 2010 at 6:51 AM, john2095 wrote: > But does this all amount to an expectation that it will restrict the > upload to an image?? > > I've got this in my model: > > class Photo(models.Model): >    image = models.ImageField(upload_to='photos') > > and this in my view: >    try: >      

Re: Unicode problems

2010-03-22 Thread Tom Evans
On Sun, Mar 21, 2010 at 9:00 PM, Ruturaj Dhekane wrote: > Hi, > > I am designing a portal that uses Hindi language using Django. > When I pass a hindi word from client side to server, in Unicode format, it > gets converted to कर्मचारी > type of string on server side. > > I want to process this str

Re: Unicode problems

2010-03-22 Thread Daniel Roseman
On Mar 21, 9:00 pm, Ruturaj Dhekane wrote: > Hi, > > I am designing a portal that uses Hindi language using Django. > When I pass a hindi word from client side to server, *in Unicode format*, it > gets converted to > *कर्मचारी*type of > string on server side. > > I want to process this string as u

Re: Strings in page in []

2010-03-22 Thread bruno desthuilliers
On Mar 22, 12:26 am, serek wrote: > Hi > > I use djangoflashhttp://djangoflash.destaquenet.com/ > and after add message to flash >             request.flash.add('message', 'test') > and redirect > i receive > ['test'] > instead > test Well, that's the documented behaviour : using "flash.add('key