Custom handler404 for an app

2009-04-27 Thread Dmitriy Sodrianov
Hi there! Is there a way of customizing handler404 for a different apps of the project? That is - I have one app for a client part and one more for a admin part and certainly they should have different designs at all. --~--~-~--~~~---~--~~ You received this message

Re: Django beta slower with some queries?

2009-04-27 Thread julianb
On Apr 27, 10:41 pm, Malcolm Tredinnick wrote: > > Reading the part "Performance considerations" got me in the right > > direction but didn't help me very well, because if you do it like > > that, it will still do a subselect. > > That's a documentation bug. There should be a list() call wrapped

Re: Blocking multiple form submissions from the same IP address

2009-04-27 Thread Rex
On Apr 26, 6:58 pm, Will Hardy wrote: > I would allow the multiple submissions, but make a note of any IP > addresses to let you exclude the data in the analysis stage.  From > memory the following "meta" variables might be relevant: > HTTP_CLIENT_IP, REMOTE_ADDR, HTTP_X_FORWARDED_FOR comma sep

Re: auth.contrib silently catching TypeError. Bug?

2009-04-27 Thread Tamas Szabo
On Tue, Apr 28, 2009 at 12:31 PM, James Bennett wrote: > > On Mon, Apr 27, 2009 at 10:49 PM, Tamas Szabo wrote: >> I'm new to Python so I might not understand how keyword arguments work, BUT >> you do assume that authenticate will always be called with keyword >> arguments which isn't true. > >

Re: Template within a Template

2009-04-27 Thread Marcelo Ramos
On Mon, Apr 27, 2009 at 9:12 PM, Renato Untalan wrote: > > Hey guys, > > In my current project, I'm making a soap call to a remote server, > which will return to me a Django template. > Once I have the Django template, I insert it into my Context object, > and when it renders, it renders the temp

MultipleHiddenInput() causes has_changed() to always be true?

2009-04-27 Thread Margie
In one of my forms I've declared a MultipleHiddenInput(), like this: self.fields['tiles'].widget = forms.MultipleHiddenInput() In my model, tiles is a manyToMany field. When I get the POST from this form, I find that the has_changed() function returns true for the form due to this 'tile

Re: auth.contrib silently catching TypeError. Bug?

2009-04-27 Thread James Bennett
On Mon, Apr 27, 2009 at 10:49 PM, Tamas Szabo wrote: > I'm new to Python so I might not understand how keyword arguments work, BUT > you do assume that authenticate will always be called with keyword > arguments which isn't true. If you look at how django.contrib.auth.authenticate is implemented

Re: auth.contrib silently catching TypeError. Bug?

2009-04-27 Thread Tamas Szabo
Hi Carl, On Mon, Apr 27, 2009 at 10:14 PM, Carl Meyer wrote: > > Hi Tamas, > > On Apr 23, 3:25 am, Tamas Szabo wrote: >> For example if I have a Token based authenticator >> (authenticate(token)) that is configured to be after my User/Password >> based authenticator (authenticate(user, password

Re: Strange inconsistency between SQL and ORM with SQLite.

2009-04-27 Thread Tai Lee
I've tested with `django.db.connection` and `pysqlite2` in python and the sqlite3 prompt, all work as expected. Only using `extra()` with both `select` and `select_params` doesn't work. I've opened up a ticket [1] for this. After discussion with Alex Gaynor on IRC, it looks like the problem is th

Template within a Template

2009-04-27 Thread Renato Untalan
Hey guys, In my current project, I'm making a soap call to a remote server, which will return to me a Django template. Once I have the Django template, I insert it into my Context object, and when it renders, it renders the template in plain text, and does not show any of the HTML tags. My conte

Re: automatic updates for a set of model objects via email

2009-04-27 Thread Timboy
Reading back through I might still not have explained simply enough. I have a VehicleSearch Model with a m2m to Vehicle and a FK to User. I want to be able to notify the user that has the VehicleSearch object when a vehicle inside of the m2m has been added or updated. I'm looking for the best wa

Re: When updating a model instance, list changed fields from inside save()?

2009-04-27 Thread JK Laiho
> In your save method, if self has a value for 'id' we know it already > exists in the database. We can therefore use that id to get another > instance with that ID, fresh from the database. This will have the > *old* values. We can therefore iterate through the attributes of both > the new and ol

Re: FileField error

2009-04-27 Thread Andrew Smith
It depends if you are running under the dev server or not. If you are then yes, you need to add that path to your urls to serve as static files. I fyou are running under apache then you should be letting apache handle serving static files. Have a look at the documentation on apache deployment to se

Re: ignore urls

2009-04-27 Thread David Keegan
It turned out to be a problem with how I was formating my wordpress urls. Sorry for the post, thanks for the help! I'm sure LocationMatch will be helpful soon :) On Mon, Apr 27, 2009 at 12:38 PM, Malcolm Tredinnick < malc...@pointy-stick.com> wrote: > > On Mon, 2009-04-27 at 12:25 -0700, keegan3d

Re: Django beta slower with some queries?

2009-04-27 Thread Malcolm Tredinnick
On Mon, 2009-04-27 at 13:11 -0700, julianb wrote: [...] > In my code, I just used a queryset as parameter for __in and in > previous Django versions it would evaluate to a list of numbers > whereas now it does a subselect. I don't think that's very backwards > compatible. It's fully backwards com

Re: Google Appengine patch and Apengine Helper

2009-04-27 Thread Waldemar Kornewald
Hi, On Apr 27, 5:12 pm, Lakshman Prasad wrote: > I managed to successfully use the second app (appengine-patch). Thanks. > > > but there has not been any visible activity > > on 1)app-engine Django since about August 08 > > Altho' there hasn't been a release, there has been continuous (weekly) >

Re: Django beta slower with some queries?

2009-04-27 Thread julianb
On Apr 24, 6:05 pm, Karen Tracey wrote: > I'd start by using a couple of Python shells (one using 1.0.2 and one using > 1.1 beta) and connection.queries to see if you can see the difference in SQL > generated for whatever model queries your view is using: > > http://docs.djangoproject.com/en/dev/

Re: Replacing the standard User class with a custom one

2009-04-27 Thread Emmanuel Surleau
On Monday 27 April 2009 21:17:44 Malcolm Tredinnick wrote: > On Mon, 2009-04-27 at 21:11 +0200, Emmanuel Surleau wrote: > > On Monday 27 April 2009 20:12:13 karl wrote: > > > > Apologies in advance, I'm sure this query pops up regularly. > > > > > > > > I'd like to replace the default User class w

Test client - session data is empty and won't save new entries

2009-04-27 Thread Stefan Wallner
Hi, I am writing some tests for an application I am developing, in my test case's setUp I do self.dummy1 = User.objects.create_user('dummy1', 'n...@example.com', self.c = Client() self.c.login(username='dummy', password='dummy') In one of the tests I POST some data and then check that the respon

Re: ignore urls

2009-04-27 Thread Malcolm Tredinnick
On Mon, 2009-04-27 at 12:25 -0700, keegan3d wrote: > I'm having trouble getting django to ignore my blog urls. > > I run wordpress from /blog, and django from /. /blog is working, but > if I try to navigate to anything deeper django takes over. > > http://inscopeapps.com/blog/ - works > http://i

ignore urls

2009-04-27 Thread keegan3d
I'm having trouble getting django to ignore my blog urls. I run wordpress from /blog, and django from /. /blog is working, but if I try to navigate to anything deeper django takes over. http://inscopeapps.com/blog/ - works http://inscopeapps.com/blog/wp-django/ - does not work I set this in the

Re: Replacing the standard User class with a custom one

2009-04-27 Thread Malcolm Tredinnick
On Mon, 2009-04-27 at 21:11 +0200, Emmanuel Surleau wrote: > On Monday 27 April 2009 20:12:13 karl wrote: > > > Apologies in advance, I'm sure this query pops up regularly. > > > > > > I'd like to replace the default User class which comes with Django's > > > authentication system (for my applicat

Re: i need a unlimited subcategories

2009-04-27 Thread R. Gorman
Treebeard is another option. http://code.google.com/p/django-treebeard/ I'm sure between mptt or treebeard, you'll find something suitable. R. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Replacing the standard User class with a custom one

2009-04-27 Thread Emmanuel Surleau
On Monday 27 April 2009 20:12:13 karl wrote: > > Apologies in advance, I'm sure this query pops up regularly. > > > > I'd like to replace the default User class which comes with Django's > > authentication system (for my application, users login via > > email/password, not login/password, so it's

FileField error

2009-04-27 Thread Jesse
I am receiving this error when requesting a pdf file that was uploaded in admin using FileField Page not found (404) Request Method: GET Request URL:http://127.0.0.1:8000/site_media/pdf/Alg_.pdf The settings file: MEDIA_URL = 'http://127.0.0.1:8000/site_media/' the models file: in

ForeignKey Select List Filter

2009-04-27 Thread cfiles
I have a model with a ForeignKey to another model. Is it possible to filter the HTML select list for the foreign object from a view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

getting local variables in custom exception middleware

2009-04-27 Thread skunkwerk
Hi, i've been using django-db-log for logging exceptions when Debug=False, and I'd like to add the ability to log the local variables as well. Here is what I tried: def process_exception(self, request, exception): local_vars = repr(exception.tb_frame.f_locals.items()) however, tb_frame

Re: Replacing the standard User class with a custom one

2009-04-27 Thread karl
> Apologies in advance, I'm sure this query pops up regularly. > > I'd like to replace the default User class which comes with Django's > authentication system (for my application, users login via email/password, not > login/password, so it's not only a matter of adding fields). > > Is there an e

Re: Overriding save() method on models to automatically add ManyToMany relationship

2009-04-27 Thread Adam Olsen
On Mon, Apr 27, 2009 at 11:27 AM, Alex Gaynor wrote: > The issues if the method, it's nonsensical and doesn't correspond to > anything(you are instantiating models.Model with save as the first > argument), in Python the correct way to call the parent class's method is: > > super(MyClass, self).s

Re: mysite.polls: __init__() got an unexpected keyword argument 'max_length'

2009-04-27 Thread bconnors
With my ubuntu I can’t type @ So I can’t do : export PYTHONPATH=/path/to/your/django/checkout to the directory I was using which was pubu...@pubuntu:~/djsite/mysite$ so I thought I’d use /usr/share/bob because it has no @ but that doesn’t work either: + svn co http://code.djangoproject.com/svn/d

Re: Overriding save() method on models to automatically add ManyToMany relationship

2009-04-27 Thread Alex Gaynor
On Mon, Apr 27, 2009 at 1:24 PM, Adam Olsen wrote: > > I've got two models, something like this: > > class Category(models.Model): >name = models.CharField(max_length=60) > > class Product(models.Model): >sku = models.CharField(max_length=20) >categories = models.ManyToManyField(Categ

Overriding save() method on models to automatically add ManyToMany relationship

2009-04-27 Thread Adam Olsen
I've got two models, something like this: class Category(models.Model): name = models.CharField(max_length=60) class Product(models.Model): sku = models.CharField(max_length=20) categories = models.ManyToManyField(Category) I want to overload the save method to automatically add cer

Re: mysite.polls: __init__() got an unexpected keyword argument 'max_length'

2009-04-27 Thread Karen Tracey
On Mon, Apr 27, 2009 at 10:40 AM, bconnors wrote: > [snip stuff related to removing old Django level] > I found that my site/packages is in /usr/lib/python2.5/site-packages > and in that directory I did > pubu...@pubuntu:~/djsite/mysite$ cat dj > svn co http://code.djangoproject.com/svn/django/tr

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-27 Thread NoviceSortOf
Thanks Malcom... Simply adding values() to the query with author and title to the search worked perfectly in limiting the SQL DISTINCT criteria to the relevant fields, Using... results = Titles.objects.values('author','title').filter(qset).order_by ().distinct() Django provides this elegant an

Re: Replacing the standard User class with a custom one

2009-04-27 Thread Malcolm Tredinnick
On Mon, 2009-04-27 at 08:09 +0200, Emmanuel Surleau wrote: > Hello, > > Apologies in advance, I'm sure this query pops up regularly. > > I'd like to replace the default User class which comes with Django's > authentication system (for my application, users login via email/password, > not > lo

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-27 Thread Malcolm Tredinnick
On Mon, 2009-04-27 at 08:51 -0700, NoviceSortOf wrote: > > Thanks for the as_sql() function as can now can > see the SQL detail. Which reveals a problem in > getting DISTINCT to draw from a fields or fields that can in fact > return the unique result of the query. Perhaps it is my usage > of the

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-27 Thread NoviceSortOf
Thanks for the as_sql() function as can now can see the SQL detail. Which reveals a problem in getting DISTINCT to draw from a fields or fields that can in fact return the unique result of the query. Perhaps it is my usage of the function so I'm listing an examble below. To further simplify my e

Re: ManyToMany relationship being 'lost'?

2009-04-27 Thread Rubens Altimari
Hey Jorge, > The relation disappears when (existing a relation) y use this modelForm > without including any info for the friends field (I don't what to edit this > information at this point). At this moment, django erases the relation > within A an B because wasn't explicit declared and the form

Re: Google Appengine patch and Apengine Helper

2009-04-27 Thread Lakshman Prasad
I managed to successfully use the second app (appengine-patch). Thanks. > but there has not been any visible activity > on 1)app-engine Django since about August 08 Altho' there hasn't been a release, there has been continuous (weekly) activity even in the earlier helper project. http://code.goog

Re: mysite.polls: __init__() got an unexpected keyword argument 'max_length'

2009-04-27 Thread bconnors
I did : apt-get remove python-django then pubu...@pubuntu:~/djsite/mysite$ sh -x lk1 pubu...@pubuntu:~/djsite/mysite$ dpkg -l python-django Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/ T-pend |/ Err?=(none)/Hold/Reinst-required/X

Re: Getting data post from input with multiple name

2009-04-27 Thread eli
Ok, I'm going to use string (like: items_{{ data.id }}) Thanks. regards. On 26 Kwi, 21:31, Malcolm Tredinnick wrote: > On Sun, 2009-04-26 at 10:20 -0700, eli wrote: > > Hi, > > > I have problem: > > In my template, I have some inputs with multiple name like: > > > value="{{ data.name }}" /> >

Re: ManyToMany relationship being 'lost'?

2009-04-27 Thread Jorge Bastida
Hello Rubens,I have similar problems months ago. In my application there is a ManyToMany relation within two classes (A and B) let's name the relation as "friends". The application works fine but in unpredictable situations rows from the auxiliary table that makes the relation disappears randomly.

Re: auth.contrib silently catching TypeError. Bug?

2009-04-27 Thread Carl Meyer
Hi Tamas, On Apr 23, 3:25 am, Tamas Szabo wrote: > For example if I have a Token based authenticator > (authenticate(token)) that is configured to be after my User/Password > based authenticator (authenticate(user, password)) in settings.py the > current code will call the user/password based au

Re: i need a unlimited subcategories

2009-04-27 Thread Paul Nema
Modified Preorder Tree Traversal (mptt) http://code.google.com/p/django-mptt/ On Mon, Apr 27, 2009 at 9:52 AM, joker wrote: > > how can i use unlimited category? > > like > > category1 >subcategory1-1 > subcategory1-1-1 > subcategory1-1-2 > subcategory1-1-3 >

i need a unlimited subcategories

2009-04-27 Thread joker
how can i use unlimited category? like category1 subcategory1-1 subcategory1-1-1 subcategory1-1-2 subcategory1-1-3 subcategory1-1-3-1 subcategory1-1-3-2 subcategory1-2 category2 subcategory2-1 subcategory2-2 --~--~--

Re: ManyToMany relationship being 'lost'?

2009-04-27 Thread Rubens Altimari
Russ, Thanks fo the reply! > The only thought I have is that you appear to be using a pre-existing > table to manage the m2m relationship, rather than the default produced > Django table. This shouldn't pose a problem, but it does lead me to > wonder if there is some other process that could be

Re: ManyToMany relationship being 'lost'?

2009-04-27 Thread Rubens Altimari
Hi Malcolm, >> class BidirectionalField(models.ManyToManyField): >>     def __init__(self, *args, **kwargs): >>         super(BidirectionalField, self).__init__(*args, **kwargs) >>         self.creates_table = False > BY the way, this has been discussed in the past and is really the wrong > way

Re: When updating a model instance, list changed fields from inside save()?

2009-04-27 Thread Daniel Roseman
On Apr 27, 10:08 am, JK Laiho wrote: > Something I don't know how to do in an elegant fashion: > > Given a model instance that already exists in the database and is > about to be updated (i.e. some columns of the DB row are changed), is > there a way for the instance's save() method to see what f

Re: Strange inconsistency between SQL and ORM with SQLite.

2009-04-27 Thread Tai Lee
Thanks for your feedback Malcolm. I will try to test without Django tomorrow. Since my original post I have noticed that inserting my params directly into the `select` argument with the string formatting operator works, but passing them in with the `select_params` argument causes a failure as des

Re: Disabling PRG Pattern

2009-04-27 Thread Chris Spencer
On Sun, Apr 26, 2009 at 11:26 PM, Malcolm Tredinnick wrote: > > On Sun, 2009-04-26 at 19:41 -0700, Chris wrote: >> On Apr 26, 7:40 pm, Alex Gaynor wrote: >> > On Sun, Apr 26, 2009 at 7:39 PM, Chris wrote: >> > >> > > I've noticed a Redirect/Get is issued automatically after every Post >> > > ma

When updating a model instance, list changed fields from inside save()?

2009-04-27 Thread JK Laiho
Something I don't know how to do in an elegant fashion: Given a model instance that already exists in the database and is about to be updated (i.e. some columns of the DB row are changed), is there a way for the instance's save() method to see what fields have been changed? I'm writing an app wh

Re: MySQL issues

2009-04-27 Thread google torp
Hi. I haven't used Django with mysql, but judging from your error it sounds like you haven't created the database in mysql. Django probably cannot create a db like it can when you use sqlite, as it's only a file anwyays. So you need to use your mysql tool phpmyadmin or whatever you use and create

MySQL issues

2009-04-27 Thread 83nini
Hi guys, I'm working on the tutorial on www.djangobook.com. I've created a database using "manage.py starapp books" then i modified the "models.py" file to include classes where each class represents a column in the database. then i modified the "settings.py" file to include the following: DATAB

Populating an ImageField from an url

2009-04-27 Thread Fabien
Hello, I'm trying to populate an ImageField with the content of an image from it's url. I'm trying with the following code : --- # image_uri is the URL of my image # new_photo.photo is the ImageField field of my new_photo instance current_file = File(urllib.urlopen(image_uri)) current_fi

Replacing the standard User class with a custom one

2009-04-27 Thread Emmanuel Surleau
Hello, Apologies in advance, I'm sure this query pops up regularly. I'd like to replace the default User class which comes with Django's authentication system (for my application, users login via email/password, not login/password, so it's not only a matter of adding fields). Is there an easy

django model request trim analog

2009-04-27 Thread Mike RA9FTM
Hi all Is there any analog of SQL trim() function in SELECT query? I need to remove spaces in strings. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djan