Re: Post URL characters problem

2010-12-08 Thread Keats
hi, How i can add it then ? i was thinking that the problem is "?" because : works perfectly any other characters in the topic_name part seems to work and since i'm only using : (.*) i didn't see how it could be an URL mismatch matter because for me (.*) means match everything ... thanx. -- Yo

Form attachment (FileField) upload not saving.

2010-12-08 Thread Sithembewena Lloyd Dube
Hi all, I have a contact form that is supposed to save a message as well as a file upload. When I use the admin site, I can save a contact record with a file upload of any type. However, saving from the 'front end' of my web application causes some strange behaviour - the file is not uploaded, an

Re: Form attachment (FileField) upload not saving.

2010-12-08 Thread Sithembewena Lloyd Dube
50% solved - I passed request.FILES into the form's constructor as indicated below: http://docs.djangoproject.com/en/1.2/topics/http/file-uploads/ I then accessed the file as follows: attachment = request.FILES['attachment'] Only problem left is to figure out why the form is posting twice. ide

Re: Post URL characters problem

2010-12-08 Thread bruno desthuilliers
On 8 déc, 10:13, Keats wrote: > hi, > How i can add it then ? > > i was thinking that the problem is "?" because : It is. Please refer to the relevant RFC: the question mark is a reserved character used to specify the beginning of a querystring. If you want it to be part of the url itself, you d

Re: Form attachment (FileField) upload not saving.

2010-12-08 Thread Sithembewena Lloyd Dube
100% fixed. I was calling save() on the form twice, once in form_capture and once in form_errors. :( On Wed, Dec 8, 2010 at 12:34 PM, Sithembewena Lloyd Dube wrote: > 50% solved - I passed request.FILES into the form's constructor as > indicated below: > > http://docs.djangoproject.com/en/1.2/

Help! I'm thick! First formset generating AttributeError

2010-12-08 Thread morgand
Either its age - the scotch - or some combination of both, but I am having problems with a SIMPLE formset. (its my first). On my formset I get an AttributeError - 'Client' object has no attribute 'ordered'... .but I dont have an attribute of that anywhere I tried changing from a "get" to a

Re: Post URL characters problem

2010-12-08 Thread Keats
tanks ! the filter urlencode did the trick. -- 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: Help! I'm thick! First formset generating AttributeError

2010-12-08 Thread fgasperino
While I haven't worked with formsets, this line doesn't look correct: formset = ClientFormSet(request.POST, request.FILES, queryset=Client.objects.get(pk=client_id)) mainly due to a parameter named queryset being passed a model object, instead of a queryset of model objects. It would seem that yo

User not authenticated after login?

2010-12-08 Thread gunnar
Dear group, I run django 1.2 on windows on the development server. I set up a login site via the standard django login view. The user is then redirected to a site built from a base template. The view that calls the base template is only available to logged-in users (via the @login_required decora

Re: User not authenticated after login?

2010-12-08 Thread Daniel Roseman
On Dec 8, 3:20 pm, gunnar wrote: > Dear group, > > I run django 1.2 on windows on the development server. > > I set up a login site via the standard django login view. The user is > then redirected to a site built from a base template. The view that > calls the base template is only available to l

When to use Form API

2010-12-08 Thread christian.posta
Do django developers use the Form API any time form elements need to be displayed to users? Or do you just code the form yourself in the templates and manually process them for smaller forms? In general, is it always better to use the Form API for any form you display, regardless how simple, becau

can't add via admin, get django template error

2010-12-08 Thread JeffH
So I'm working along, everything's humming fine. Then I try to add a record via the admin, and get the following: TemplateSyntaxError at /admin/expert/expertresponse/add/ Caught AttributeError while rendering: 'unicode' object has no attribute 'date' [snip] Template error In template c:\python2

Re: Django based issue tracker

2010-12-08 Thread zodman
that use django-template* app .. can change it. On Wed, Dec 8, 2010 at 12:30 AM, derek wrote: > The button on the first page of http://www.django-projector.org/ says > "Sing up for the demo project".  Makes a refreshing change from the > usual getting started red-tape ;) > > On Dec 7, 6:59 am, zo

Re: Alphabetic filtering of Django Admin drop down menu

2010-12-08 Thread vjimw
Should your relationship be Many-to-Many I found this to be very helpful: Autocomplete manytomany widget for admin panel http://djangosnippets.org/snippets/1365/ On Dec 7, 1:29 pm, Heigler wrote: > If you can't use raw_id_fields i guess you should write that view and > use javascript to search i

Re: When to use Form API

2010-12-08 Thread Wayne Smith
It is important to distinguish between display and functionality with forms. What I mean is, using the forms does not mean you have to render (display) them the way Django has it set up by default. I always use the Form API, and if I need custom validation on a field or the entire form, I overrid

IN clause in raw sql

2010-12-08 Thread dgmyrs
Hi, I am trying to work with an in clause in my sql in a raw sql statement. A simplified example: >>>Category.objects.raw('select * from app_category where name >>>in(\'Restaurants\',\'Fast Food\')')[0] So that works fine with the in clause hard coded in there, and I could simply build that

__init__.py file executed twice ?

2010-12-08 Thread martvefun
Hello, I'd like to start some threads when the server launch to listen to events (I'm doing message passing). To do so, I guess I should be using the __init__.py file at the root of my project (by the way, what's the used of the other __init__.py files in the apps) I've tried with a simple test

Re: __init__.py file executed twice ?

2010-12-08 Thread Tom Evans
On Wed, Dec 8, 2010 at 4:52 PM, martvefun wrote: > Hello, > > I'd like to start some threads when the server launch to listen to > events (I'm doing message passing). > > To do so, I guess I should be using the __init__.py file at the root of > my project (by the way, what's the used of the other

Re: IN clause in raw sql

2010-12-08 Thread Tom Evans
On Wed, Dec 8, 2010 at 5:21 PM, dgmyrs wrote: > Hi, I am trying to work with an in clause in my sql in a raw sql > statement.  A simplified example: > > Category.objects.raw('select * from app_category where name in(\'Restaurants\',\'Fast Food\')')[0] > > > > So that works fine with th

Re: IN clause in raw sql

2010-12-08 Thread dgmyrs
That's a simplified sql just as an example. The actual one I need the in clause is a lot more complex and can't be handled in the ORM. On Dec 8, 11:40 am, Tom Evans wrote: > On Wed, Dec 8, 2010 at 5:21 PM, dgmyrs wrote: > > Hi, I am trying to work with an in clause in my sql in a raw sql > > s

Re: When to use Form API

2010-12-08 Thread ringemup
This. Form processing is one of those tedious things 90% of which is the same in every form: field definition, display, validation, and error handling/presentation. Django takes care of the repetitive parts, and if you need to customize the validation or display, allows you to do so while still a

Re: __init__.py file executed twice ?

2010-12-08 Thread martvefun
On 08-12-10 18:39, Tom Evans wrote: > On Wed, Dec 8, 2010 at 4:52 PM, martvefun wrote: >> Hello, >> >> I'd like to start some threads when the server launch to listen to >> events (I'm doing message passing). >> >> To do so, I guess I should be using the __init__.py file at the root of >> my pro

Re: returning type and value

2010-12-08 Thread mongoose
Thanks Tom, worked like a charm. So actually qs is a collection of results and I can iterate through them. Good to know. Cheers. On Dec 7, 7:52 pm, Tom Evans wrote: > On Tue, Dec 7, 2010 at 5:29 PM, mongoose wrote: > > Hi all, > > > I have this in my model.py > >        def recipe_cost(self):

FileField and location and storage

2010-12-08 Thread dmitry b
Hi, I've written a custom Storage that uses WebDAV as its underlying engine. When I save a file '/foo/bar/file.ext', I want it to be saved under /foo/bar in the webdav filesystem. However, it seems that FileField overrides the directory structure: def generate_filename(self, instance, filen

Re: IN clause in raw sql

2010-12-08 Thread David De La Harpe Golden
On 08/12/10 17:42, dgmyrs wrote: > That's a simplified sql just as an example. The actual one I need the > in clause is a lot more complex and can't be handled in the ORM. > [Are you _sure_? name__in=... is so much handier, django sorts it out for you...] Anyway, see also http://code.djangoproj

Re: ORA-01425

2010-12-08 Thread Jirka Vejrazka
OK - here's my 2 cents: Django 1.2.1, Oracle 9.2.0.7 Cheers Jirka In [1]: from django.db import connections In [2]: c = connections['oracle'].cursor() In [3]: c.execute(r"SELECT 1 FROM DUAL WHERE 'A' LIKE TRANSLATE('A' USING NCHAR_CS) ESCAPE TRANSLATE('\' USING NCHAR_CS)") -

Django template tags.

2010-12-08 Thread Nuño Iglesias
Hi, i think it's the first time i write to this list, so Hello to everybody...¡¡ Well, now my problem. I'm trying to use "template filters" in one of my templates. What i'm trying to do is this: {{ mystring | upper }} to convert "mystring" into upper-case. but Django is complaining:

Re: Django template tags.

2010-12-08 Thread Łukasz Rekucki
2010/12/8 Nuño Iglesias : > > What i'm trying to do is this: >   {{ mystring | upper }} > to convert "mystring" into upper-case. AFAIR, there should be no spaces before or after "|": {{ variable|upper }} -- Łukasz Rekucki -- You received this message because you are subscribed to the Google G

Re: handling generated files

2010-12-08 Thread Mark (Nosrednakram)
On Dec 7, 7:55 pm, dmitry b wrote: > Hi, > > How do I use Django's FileField with autogenerated files?  That is, > these files aren't uploaded by a user, but rather are created on the > fly.  I've looked at ContentFile, but this class doesn't seem to have > a way to attach a file name (the name is

Re: How to use django-command-extentions dumpscript?

2010-12-08 Thread fei
Have you successfully installed django-extensions into python? Here are the detailed instructions http://code.google.com/p/django-command-extensions/wiki/InstallationInstructions Fei On Dec 8, 6:30 am, mongoose wrote: > Hi all, > > I'm trying out django-command-extensions I want to use the dum

Re: Django template tags.

2010-12-08 Thread Nuño Iglesias
El Wed, 8 Dec 2010 20:00:42 +0100 Łukasz Rekucki escribió: > 2010/12/8 Nuño Iglesias : > > > > What i'm trying to do is this: > >   {{ mystring | upper }} > > to convert "mystring" into upper-case. > > AFAIR, there should be no spaces before or after "|": > {{ variable|upper }} > > Ups :-s Th

Re: can't add via admin, get django template error

2010-12-08 Thread Wayne Smith
On Wed, Dec 8, 2010 at 10:49 AM, JeffH wrote: > So I'm working along, everything's humming fine. Then I try to add a > record via the admin, and get the following: > > TemplateSyntaxError at /admin/expert/expertresponse/add/ > Caught AttributeError while rendering: 'unicode' object has no > attri

WebHelpers in Django

2010-12-08 Thread Lukasz Szymanski
Hi guys. Is it possible to add and use Webhelpers module ( http://webhelpers.groovie.org/ ) in Django ? or does anyone know something similar to this? -- 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

Re: Query about GenericTabularInline

2010-12-08 Thread nathan
Sorry. Item 1 is my fault. But I still haven't resolved item 2. On Dec 7, 1:35 pm, Nathan Geffen wrote: > Hi > > I have set up a Generic inline (using generic.GenericTabularInline). It > behaves differently (and from my application's point of view, wrongly) from > the standard admin.TabularInline

CSRF missing token

2010-12-08 Thread martvefun
Hello, I've a login form which give me an CSRF error. In the documentation, I read that I needed to have in my code : # views.py ... csrf_token = {} csrf_token.update(csrf(request)) return render_to_response('index.html', locals()) # index.html ... {% csrf_token %} But

Re: __init__.py file executed twice ?

2010-12-08 Thread Mike Dewhirst
On 9/12/2010 5:10am, martvefun wrote: On 08-12-10 18:39, Tom Evans wrote: On Wed, Dec 8, 2010 at 4:52 PM, martvefun wrote: Hello, I'd like to start some threads when the server launch to listen to events (I'm doing message passing). To do so, I guess I should be using the __init__.py file

running app in backend

2010-12-08 Thread commonzenpython
hey guys, im trying to run a script in the backend of my django project, i have used django signals to call my script and run it when foo class is saved, and in the foo class theres a variable that can be true or false, if its true it calls an infinte loop that runs a function every x seconds, but

django session InvalidOperation

2010-12-08 Thread kinder
I'm fairly new to Django, and I'm trying to move an existing Django application to a new server. The old server is running Django 1.0.2 and Python 2.5.4. The closest I could come on my new server (to start) is Django 1.0.4 and Python 2.5.5. Anyway, I get an admin login screen, but when I try to lo

django-extensions - "Error: no module named django_extensions"

2010-12-08 Thread Victor Hooi
heya, I original thought to post this in the django-extensions group, however that seems like a fairly low-traffic group, so I thought I'd post here in the hopes somebody here might be able to figure it out. Basically, I've installed django-extensions via Pip pip install django-extensions Whene

Re: running app in backend

2010-12-08 Thread Rendy Anthony
I recommend you to check on celery if you need to run background process. It has a good django support and can allows you to run periodic tasks. On Dec 9, 2010 8:44 AM, "commonzenpython" wrote: > hey guys, im trying to run a script in the backend of my django > project, i have used django signals

Re: percentage of models given field value?

2010-12-08 Thread Lachlan Musicman
On Thu, Nov 25, 2010 at 16:00, Christophe Pettus wrote: > > On Nov 24, 2010, at 8:13 PM, Lachlan Musicman wrote: >> Thanks Christopher. I've never done raw SQL in Django before. This may >> seem like a silly follow up question, but is it standard practice to >> put the relevant code, as described

Re: percentage of models given field value?

2010-12-08 Thread Lachlan Musicman
On Thu, Dec 9, 2010 at 14:13, Lachlan Musicman wrote: > On Thu, Nov 25, 2010 at 16:00, Christophe Pettus wrote: >> >> On Nov 24, 2010, at 8:13 PM, Lachlan Musicman wrote: >>> Thanks Christopher. I've never done raw SQL in Django before. This may >>> seem like a silly follow up question, but is it

Re: FileField and location and storage

2010-12-08 Thread Sam Lai
I have a custom file storage working with a specific subdir structure. Did you pass in a method specifying the path in the upload_to kwarg for FileField? Here's my model code, where EnhancedFileSystemStorage is my custom file storage class, and get_random_dir_name is just a helper method that doe

Re: django-extensions - "Error: no module named django_extensions"

2010-12-08 Thread Christophe Pettus
On Dec 8, 2010, at 6:48 PM, Victor Hooi wrote: > Not sure what's going on here? Is the django_extensions module on your PYTHONPATH? -- -- Christophe Pettus x...@thebuild.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this g

Re: FileField and location and storage

2010-12-08 Thread Sam Lai
Some more background - If you look at lines 228 to 230 of django/db/models/fields/files.py, you'll see that the generate_filename method is overwritten by your upload_to method if you specify one. 228 self.upload_to = upload_to 229 if callable(upload_to): 230

Re: django-extensions - "Error: no module named django_extensions"

2010-12-08 Thread Victor Hooi
heya, Thanks for the reply. I'm fairly sure it is in the PYTHONPATH. I'm using virtualenvs and pip to install, so it should be there in the system-wide Python directory for that environment. Also, as per my first post, I can import it fine from a Python shell, it's just it seems to act up wit

newbie question: @login_required, can't get it to work

2010-12-08 Thread Charlietuna
Hi All, I'm a newbie. I would like to use the @login_required decorator, but I don't want to redirect to the standard default accounts/login. I would like to redirect to '/login/' The book says add the following to the end of the settings.py file.: import django.contrib.auth django.contrib.auth.

Re: newbie question: @login_required, can't get it to work

2010-12-08 Thread robin nanola
on your settings.py you can just add LOGIN_URL = '/login/' On Thu, Dec 9, 2010 at 3:04 PM, Charlietuna wrote: > Hi All, > > I'm a newbie. I would like to use the @login_required decorator, but I > don't want to redirect to the standard default accounts/login. I would > like to redirect to '/log

Re: newbie question: @login_required, can't get it to work

2010-12-08 Thread Martin Melin
On Thu, Dec 9, 2010 at 8:04 AM, Charlietuna wrote: > Hi All, > > I'm a newbie. I would like to use the @login_required decorator, but I > don't want to redirect to the standard default accounts/login. I would > like to redirect to '/login/' > > The book says add the following to the end of the set

Re: Django in production on Windows

2010-12-08 Thread ashdesigner
Sam, That's exactly what we arrived at: PyISAPIe doesn't work with IIS, so I will install an Apache pack on Windows. We've already launched a VMWare (Win VPS) with no IIS running on it, and I lean to XAMPP as an appropriate Apache out-of-box pack to run on the Win platform. What would you say? Wi