wrong URL after invalid form submission

2008-05-12 Thread Mike Chambers
I am doing a simple comment submission form. The page that the comment form is on is: /item/2/ the comment form action url is: /item/comment/ On the submission, I check if the form is valid, and if it is not, I return the form to the user / template, which then displays the form errors. If

Django email and BCC recipients

2008-05-12 Thread Julien
Hi, Apparently others have had trouble with the BCC attribute of the Django email classes [1]. I also have a problem, but a bit different. The 'to' recipients receive the email, but not the 'bcc' recipients. Works: msg = EmailMultiAlternatives(subject, plain_body, sender_email, recipients)

using templates for javascript files

2008-05-12 Thread MrJogo
I'd like my javascripts to know MEDIA_URL so they can pull pictures from there (for a slideshow) and I was wondering the best way of doing this. I figure the best way would be to create one javascript file that goes through the Django templating and makes a variable available for the other script

Re: Admin : Select category -> show subcategory

2008-05-12 Thread martyn
It's true, I don't know for what reason I changed this before posting, but I've seen the error to, correct it and, no way. But I made a error on my urls, this /admin/boutique/produit/getsubcategory/ was not the same as urls.py, so I had no response. Now I've got another question. I've never used

Re: Ignore query on views?

2008-05-12 Thread RoMo
I'm sorry for not understand what you were saying about the error with get if i have more than 1 post lol... kinda silly I'm sorry... Should I use .filter(Author=user)? I tried with that and i get the next error: Incorrect integer value: '[]' for column 'Author_id' at row 1 On May 12, 12:40 pm

Re: Full-text searching in postgres with qsrf

2008-05-12 Thread Dave Lowe
Here's the Django side: results = Product.objects.extra( select={ 'rank': "rank_cd(textsearchable, query, 32)", }, tables=["to_tsquery(%s) as query"],

Re: How to determine server?

2008-05-12 Thread Chatchai Neanudorn
mod_python (django.core.handlers.modpython), request.META['GATEWAY_INTERFACE'] = 'CGI/1.1' or request.META['SERVER_SOFTWARE'] = 'mod_python'' or 'ModPythonRequest' in request.__str__() Django, wsgi handler (django.core.handlers.wsgi) 'WSGIRequest' in request.__str__() Hope this help, C

Full-text searching in postgres with qsrf

2008-05-12 Thread Dave Lowe
Since the merge of queryset-refactor into trunk, my full-text searches have broken. I'm using the method outlined in the PostgreSQL manual in section 12.3.3 (http://postgresql.com.cn/docs/8.3/static/textsearch- controls.html#TEXTSEARCH-RANKING). The error message I get is: relation "to_tsquery(1)

How to determine server?

2008-05-12 Thread Bob
I'd like to find out whether I'm running under the Django development server or mod_python. How can I do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Validating image and file upload via the admin

2008-05-12 Thread Brandon Taylor
Hello everyone, Does anyone have a good strategy for validating image and file uploads? Like checking that images are the correct file type, dimensions are within bounds, etc. I see where we can override the save method on a model, but how would we go about accessing properties of an uploaded fi

Re: dynamic default values for Forms

2008-05-12 Thread davenaff
I concur with Oliver. Obviously if your dynamic user_name is a variable, it would look like this: form=MyForm(initial={'user_name':user_name}) And of course, this is written in the view. On May 12, 2:41 pm, oliver <[EMAIL PROTECTED]> wrote: > I do it like this: > > def frommagic(request): >

Imports in other modules impact doctests

2008-05-12 Thread davenaff
Over the weekend I ran into problems getting doctests to run. I found that imports in other modules were causing the model classes to not be recognized by _doctest: http://groups.google.com/group/django-users/browse_thread/thread/10f82ec0cea4ee3b I ran out of time before I was able to determine

handling form errors in separate app

2008-05-12 Thread Mike Chambers
I am working on a simple comment app that is meant to be generic and reusable. Everything is going well, but the one thing I am having a problem with is how to handle comment submissions that dont validate. For a normal form post, I would just validate the Form in the view, and then render the

Many-to-many relationship on self - inherited model

2008-05-12 Thread Gollum
I've inherited django.contrib.auth.User model class MyUser(User): friends = models.ManyToManyField("self", symmetrical = False, related_name = 'f_set') objects = UserManager() class Admin: pass Other fields were removed for simplicity. Now I run shell and

Re: clean_xxx field not working - help please

2008-05-12 Thread Brandon Taylor
Specifically, I'd like to use this validation in the admin. Is the best way to do this by overriding the save() method? On May 12, 3:32 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm attempting to do some image validation. Here is my model: > > from django.db import models >

Re: dynamic default values for Forms

2008-05-12 Thread oliver
I do it like this: def frommagic(request): if request.POST: process form else: from = MyForm(initial={'user_name': 'John Doe' }) works well in our quite complex 6 step booking form .. On May 12, 9:37 pm, Mike Chambers <[EMAIL PROTECTED]> wrote: > I have a project where I need to dyn

dynamic default values for Forms

2008-05-12 Thread Mike Chambers
I have a project where I need to dynamically set the default values for a form field. I have come up with the following solution, but wanted to check here to see if anyone saw any problems with it: MyForm class MyForm(forms.Form): user_name = forms.CharField(min_length=1, max_le

Re: Getting back to the same page after completing a task in another page

2008-05-12 Thread M.Ganesh
Adi Jörg Sieker wrote: > Hi, > On 12.05.2008, at 22:07, Adi Jörg Sieker wrote: > >> but the idea is the same. >> >> def login_view(request, next_url_from_page): > this might need to be a default parameter like: > def login_view(request, next_url_from_page=None): > >> if request.method == 'POST': >

clean_xxx field not working - help please

2008-05-12 Thread Brandon Taylor
Hi everyone, I'm attempting to do some image validation. Here is my model: from django.db import models GROUP_CHOICES = ( ('Home Page', 'Home Page'), ('Tenets Sidebar', 'Tenets Sidebar'), ) class Image(models.Model): group = models.CharField(max_length=20, cho

Re: Getting back to the same page after completing a task in another page

2008-05-12 Thread Adi Jörg Sieker
Hi, On 12.05.2008, at 22:07, Adi Jörg Sieker wrote: > but the idea is the same. > > def login_view(request, next_url_from_page): this might need to be a default parameter like: def login_view(request, next_url_from_page=None): > if request.method == 'POST': > do your login stu

Re: Authentication backend question

2008-05-12 Thread alex finn
Ramiro, thanks for the link, that's really what I need. I will create a middleware for my authentication needs. To be more specific on what I need: we have a huge infrastructure with many different web-based systems running on different servers and created with different technologies/platforms. B

Re: Announcing Deco: static content for Django

2008-05-12 Thread Alex Morega
On May 12, 2008, at 23:01 , Sander Steffann wrote: > > Hi, > >> I can't test it however because I am getting a 404 from the link >> above. > > It's missing the trailing slash. Try http://grep.ro/projects/deco/ Sorry about that. It's actually an issue with Deco, it doesn't properly honor the A

Re: Getting back to the same page after completing a task in another page

2008-05-12 Thread Adi Jörg Sieker
On 12.05.2008, at 20:59, M.Ganesh wrote: > > Adi Jörg Sieker wrote: >> >> On 12.05.2008, at 15:13, M.Ganesh wrote: >> >>> Thanks Ronny for your response, however this doesn't answer my >>> requirement. Probably I've to state my requirement more clearly. >>> I have >>> various pages for general

Re: Announcing Deco: static content for Django

2008-05-12 Thread Sander Steffann
Hi, > I can't test it however because I am getting a 404 from the link > above. It's missing the trailing slash. Try http://grep.ro/projects/deco/ - Sander --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: Announcing Deco: static content for Django

2008-05-12 Thread rcs_comp
Alex, This sounds like a pretty good idea, I will have to take a look. I have a very similar module in a PHP framework I built and use it often to give my customers a "CMS" aspect to their website. I can't test it however because I am getting a 404 from the link above. Thanks. On May 12, 12:3

Re: Getting back to the same page after completing a task in another page

2008-05-12 Thread M.Ganesh
Valts Mazurs wrote: > On Mon, May 12, 2008 at 4:13 PM, M.Ganesh <[EMAIL PROTECTED] > > wrote: > > > Thanks Ronny for your response, however this doesn't answer my > requirement. Probably I've to state my requirement more clearly. > I have > various pages

Re: Getting back to the same page after completing a task in another page

2008-05-12 Thread M.Ganesh
Adi Jörg Sieker wrote: > > On 12.05.2008, at 15:13, M.Ganesh wrote: > >> Thanks Ronny for your response, however this doesn't answer my >> requirement. Probably I've to state my requirement more clearly. I have >> various pages for general viewing where authentication is not required. >> But if a

Re: Modifying only one widget in newform

2008-05-12 Thread Smacc
Jeff, you are my hero. Thanks. Smacc. > Which version of django are you using? In trunk, using > newforms/modelforms for generating the form from a model, it is done > like this: > > If you want to override a field’s default widget, then specify the > widget parameter when declaring the form fie

Re: Authentication backend question

2008-05-12 Thread Ramiro Morales
On Mon, May 12, 2008 at 10:48 AM, finnam <[EMAIL PROTECTED]> wrote: > > Hi, > > I need to create a custom authentication backend that will > authenticate user based on the HTTP headers for the request. But in > django manual I don't see any way to obtain HttpRequest instance in > the authenti

Re: Ignore query on views?

2008-05-12 Thread Romo
It works!! Thanks a lot for your help, Adi! cheers On May 12, 12:25 pm, Adi Jörg Sieker <[EMAIL PROTECTED]> wrote: > On 12.05.2008, at 18:57, RoMo wrote: > > > > > > > Hello guys! > > > First of all I don't know if I'm asking the right question, but i'll > > try to explain myself the best I can

Re: tutorial part 4 - vote problem

2008-05-12 Thread LRP
Hi, I've run into exactly the same problem. And I did follow "Part 3 Decoupling the URLconfs." Actually, this part of the otherwise superb tutorial is a bit sketchy. It would be helpful if it showed the state of both urls.py (both versions -- mysite/urls.py and polls/urls.py and views.py prior t

Re: Ignore query on views?

2008-05-12 Thread Adi Jörg Sieker
On 12.05.2008, at 18:57, RoMo wrote: > > Hello guys! > > First of all I don't know if I'm asking the right question, but i'll > try to explain myself the best I can: > > I would like to know if in a view there is a way that after a "try:" > and evaluate the expression as false, it justs ignores t

Re: Announcing Deco: static content for Django

2008-05-12 Thread Alex Morega
On May 12, 2008, at 20:00 , Masklinn wrote: > > > On 12 May 2008, at 18:33 , Alex Morega wrote: > >> >> Hello, I would like to announce a new project: >> >> Deco is a reusable django app for handling static content. It's like >> django.contrib.flatpages, only much more flexible. >> >> Deco can r

Re: Announcing Deco: static content for Django

2008-05-12 Thread Masklinn
On 12 May 2008, at 18:33 , Alex Morega wrote: > > Hello, I would like to announce a new project: > > Deco is a reusable django app for handling static content. It's like > django.contrib.flatpages, only much more flexible. > > Deco can render plain HTML, Markdown, Textile, and even Django > temp

Ignore query on views?

2008-05-12 Thread RoMo
Hello guys! First of all I don't know if I'm asking the right question, but i'll try to explain myself the best I can: I would like to know if in a view there is a way that after a "try:" and evaluate the expression as false, it justs ignores that query and display a message error, but keep load

Re: XHR Request Headers

2008-05-12 Thread Szaijan
I resolved this by using MochiKit's evalJSONRequest instead of using JS eval on request.response_text. Here's sample code for a MochiKit JS to Django AJAX function: selectEntity : function (entity) { try { var url = '/' + ['visionary', this.model.url ? this.mo

Re: Modifying only one widget in newform

2008-05-12 Thread Jeff Anderson
Smacc Kleina wrote: Hi folks, we have some input forms in our project where 'meta' generated forms are enough. But we have to change widget to tinymce enabled 'richedit' fields in CharFields. Is it possible to change only one widget and keep auto-generated form? Which version of django are you

Re: IE6 problem

2008-05-12 Thread Jeff Anderson
Robin Becker wrote: I have a problem with django administration and IE6. Basically no matter what I do I get a cookies problem when trying to log in to /admin. It seems that this website is permanently cookie blocked by IE6. I have tried going to the provacy policy etc etc internet settings, bu

Re: response.write and memory, newbie question!

2008-05-12 Thread Andrew Smith
Thanks On May 12, 5:27 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote: > Andrew, it will build up its contents in memory. Consider how an exception > thrown in your view will cause the response never to even be sent. > > Your best bet if you want to do streaming is to pass an iterator to the > Htt

Announcing Deco: static content for Django

2008-05-12 Thread Alex Morega
Hello, I would like to announce a new project: Deco is a reusable django app for handling static content. It's like django.contrib.flatpages, only much more flexible. Deco can render plain HTML, Markdown, Textile, and even Django templates. It can serve static pages or static pieces of pages

Re: response.write and memory, newbie question!

2008-05-12 Thread Scott Moonen
Andrew, it will build up its contents in memory. Consider how an exception thrown in your view will cause the response never to even be sent. Your best bet if you want to do streaming is to pass an iterator to the HttpResponse constructor. Your iterator should yield strings to its caller. --

Re: response.write and memory, newbie question!

2008-05-12 Thread Matthias Kestenholz
Hi, On Mon, 2008-05-12 at 09:16 -0700, Andrew Smith wrote: > Hello > > When I use response as a file-like object, by calling response.write > or passing it to something which expects a file-like object, does it > build up its contents in memory or stream them straight to the > browser? It build

response.write and memory, newbie question!

2008-05-12 Thread Andrew Smith
Hello When I use response as a file-like object, by calling response.write or passing it to something which expects a file-like object, does it build up its contents in memory or stream them straight to the browser? TIA Andy --~--~-~--~~~---~--~~ You received thi

Re: newforms and views.generic.create_update.create_object

2008-05-12 Thread Wes Winham
I've been using Brian Rosner's patch from that ticket, and it's been working great for me. I haven't ran in to any bugs so far and it's cut my view code down by several lines each view in some places and completely eliminated view code in many others. Gotta love newforms and modelforms :) I might

Many to Many Inline Editing

2008-05-12 Thread JReynolds
I have seen this posted a few times on the list here, but it always seems to become a discussion about the many to many implementation and move away from making it work as the one to many inline editing works in the newforms-admin branch. So... does anyone have a fix for being able to add/edit/de

Re: Drop all tables

2008-05-12 Thread Chris Czub
Additionally, you could use `django-admin.py flush` to wipe all the database tables and reset them to the state they were in after you initially syncdb'ed. http://www.djangoproject.com/documentation/django-admin/ On Mon, May 12, 2008 at 10:20 AM, Chris Czub <[EMAIL PROTECTED]> wrote: > If you ar

Modifying only one widget in newform

2008-05-12 Thread Smacc Kleina
Hi folks, we have some input forms in our project where 'meta' generated forms are enough. But we have to change widget to tinymce enabled 'richedit' fields in CharFields. Is it possible to change only one widget and keep auto-generated form? Any hints are welcome, Smacc. --~--~-~--~~-

Re: Where'd my error go?

2008-05-12 Thread Marty Alchin
On Mon, May 12, 2008 at 1:28 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > This should probably be filed as a bug since the docs(http:// > www.djangoproject.com/documentation/custom_model_fields/) show an > example of raising a TypeError. So it does, I hadn't noticed that. I've filed a ti

Re: Django Performance using PyISAPIe on IIS Rocks

2008-05-12 Thread rcs_comp
Mat, You are right, I should have done that. I setup eAccelerator for IIS in both FastCGI and ISAPI modes. Unfortunately, I could not get eAccelerator working in non-thread-safe mode with FastCGI (which is what Microsoft recommends). Here are my results: PHP ISAPI eAccelerator Symfony: 25.06

Re: Drop all tables

2008-05-12 Thread Chris Czub
If you are using SQLite you could just delete the database file. If not, I'm confused at why you'd have access to the shell but not access to the database - do you not have access to the database you are working on or something? If so, I would ask whoever has access to it to drop the tables for you

Value from bound_field objects

2008-05-12 Thread mbdtsmh
Hi all, How would you go about extracting the value from a bound_field object? (within the admin change_form.html template) At the moment I am using {{ bound_field.original|get_value_x }} {{ bound_field.original|get_value_y }} this pulls back the values from the model as described in the def _

Re: Getting back to the same page after completing a task in another page

2008-05-12 Thread Adi Jörg Sieker
On 12.05.2008, at 15:13, M.Ganesh wrote: > Thanks Ronny for your response, however this doesn't answer my > requirement. Probably I've to state my requirement more clearly. I > have > various pages for general viewing where authentication is not > required. > But if a user decides to add a r

Authentication backend question

2008-05-12 Thread finnam
Hi, I need to create a custom authentication backend that will authenticate user based on the HTTP headers for the request. But in django manual I don't see any way to obtain HttpRequest instance in the authenticate() method. For example, if I receive a request with http header USER_NAME equal to

Re: Getting back to the same page after completing a task in another page

2008-05-12 Thread Valts Mazurs
On Mon, May 12, 2008 at 4:13 PM, M.Ganesh <[EMAIL PROTECTED]> wrote: > > Thanks Ronny for your response, however this doesn't answer my > requirement. Probably I've to state my requirement more clearly. I have > various pages for general viewing where authentication is not required. > But if a us

Re: Getting back to the same page after completing a task in another page

2008-05-12 Thread M.Ganesh
Ronny Haryanto wrote: > On Sun, May 11, 2008 at 11:55 AM, M.Ganesh <[EMAIL PROTECTED]> wrote: > >> I am displaying a list of records in a page. I have a link in that page >> which will take me to a form for adding one more record. How do I come >> back to the previous page after adding a record

"^(≡°;°�...♥♥.DO YOU KNOW ?????? EASIEST WAY TO EARN.................................................,IF NOT WANT TO LOSE THE OPPORTUNITY........"^(≡°;°�...♥♥....

2008-05-12 Thread sharal
HI,FRIENDS give a few min to it every day,and earn millions per month http://yuwietip.com/i?i=563559 you can join here ,chat to peoples,make friends,and you will be paid,for uploading pictures,and also if any body views your profile,so no effort is needed,just join , http://yuwietip.com/i?i=56

Re: mod_python vs. mod_wsgi

2008-05-12 Thread Graham Dumpleton
On May 12, 8:04 am, Pigletto <[EMAIL PROTECTED]> wrote: > > Obviously be aware that in daemon mode you will still have multithread > > issues to contend with if they run with multiple threads. To avoid it > > you would need a config such as: > > >   ... processes=5 threads=1 > > > Ie., use prefo

Re: urls() and request.user

2008-05-12 Thread Guillaume Lederrey
Hello ! I finally choose to create a decorator to implement this functionality. I wanted something more generic than a wrapper in my urls.py. The solution seems to work fine for me, and if anybody want to do the same, the code is at http://www.djangosnippets.org/snippets/753/ Of course, any sugg

RE: Django Performance using PyISAPIe on IIS Rocks

2008-05-12 Thread Mat
Dunno if you can do it on IIS (cant say ive ever tried), but try installing a PHP accelerator such as eaccelarator or APC, both are open source. This will cache your php files similar to *.pyc in python, and should give you a x8-x10 boost. It is not really a fair test without it :) It is how we ru

translations: how give precedence to project over apps

2008-05-12 Thread Alessandro Dentella
Hi, I have a project that assembles applications that I have prepared for general pourpose. One of them is a ticket application developed with software ticket in mind. Now I want to make it work for a complete different company. It turns out I just need to rename fields, not the logic.

IE6 problem

2008-05-12 Thread Robin Becker
I have a problem with django administration and IE6. Basically no matter what I do I get a cookies problem when trying to log in to /admin. It seems that this website is permanently cookie blocked by IE6. I have tried going to the provacy policy etc etc internet settings, but nothing I do seems

Color Picker works in firefox and nowhere else

2008-05-12 Thread Magdoll
I used the code from http://www.colorjack.com/software/dhtml+color+picker.html to set up a color picker in my django site. I did not change the code in any way. Using Firefox, I have no trouble dragging up and down the hues (the vertical hue bar). However in IE or other browsers, as soon as I sl

Re: Setting request-parameters per default

2008-05-12 Thread Adi Jörg Sieker
Hi, On 11.05.2008, at 09:32, mwebs wrote: > > Thanks Alex, thats a good idea. > > But I want to have a more generic solution for this problem. There > must be an other way than to write custom template tags. I think the > passing-default-request-parameters approach is the solution, but I > dont k

Drop all tables

2008-05-12 Thread mwebs
Hi, is there anyway to drop all tables without falling back to raw sql. I mean with an shell command or something like that? Thank you Toni --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To p