Re: slightly complicated radio input question

2010-12-10 Thread Ilian Iliev
Hi, there is a radio select widget for Django Forms -> http://docs.djangoproject.com/en/dev/ref/forms/widgets/ On Sat, Dec 11, 2010 at 12:59 AM, yiftah wrote: > hi > > I want to create a form with django that has a radio selection that > looks like > > Entire > Range (as

Re: How to write good form validation in Django?

2010-12-10 Thread Christophe Pettus
On Dec 10, 2010, at 4:01 PM, Ali Ghaffari wrote: > How can the view in "/thanks/" be sure that the form was validated? > Are there any common ways to pass the successful validation of the > form to the next view? Or do I need to do something manually such as > setting a flag in request's

Re: django session InvalidOperation

2010-12-10 Thread kinder
I'm stumped... even removing mod_php from the apache config (which is where I suspected a different mysql shared library), I still get the same InvalidOperation error. Any suggestions what to try next? -- You received this message because you are subscribed to the Google Groups "Django users"

How to write good form validation in Django?

2010-12-10 Thread Ali Ghaffari
I've seen Django's samples and I can see they have decent error handling. However I want to see if there is yet a better approach, a general pattern to handle form validation errors in Django. This is the sample I found here: def contact(request): if request.method == 'POST': # If the form

slightly complicated radio input question

2010-12-10 Thread yiftah
hi I want to create a form with django that has a radio selection that looks like Entire Range (as in the file) Specified Range:    Starting time     Ending time Maximum Temperature (ΔTM) only, with Savitzki-Golay polynomial no any idea how to write the form class to represent this?

Question regarding Intermediary Models and concepts

2010-12-10 Thread Victor
I have one part of a project that's responsible for registration of Users and associations with a UserProfile and a Phone Extension. The models involved include User, UserProfile, Client, Extension, and UserProfileExtension. So here's the business logic: 1. Usually the Users are created through

Re: django-reroute: a drop-in replacement for django.conf.urls.defaults that supports HTTP verb dispatch and view wrapping.

2010-12-10 Thread Mark Sandstrom
Getting started is as simple as: ... easy_install django-reroute, or pip install django-reroute ;) - Mark On Fri, Dec 10, 2010 at 4:12 PM, Mark Sandstrom wrote: > Hello all, > > This is a pretty common pattern in django: > > def view(request): > if

django-reroute: a drop-in replacement for django.conf.urls.defaults that supports HTTP verb dispatch and view wrapping.

2010-12-10 Thread Mark Sandstrom
Hello all, This is a pretty common pattern in django: def view(request): if request.method == 'GET': # Do something elif request.method == 'POST': # Do something else else: return HttpResponse(status=405) The setup for GET vs POST may be very different, and

Re: Generic Views - do you use them?

2010-12-10 Thread R. Ted Tieken
>> Class based generic views still have the major drawbacks of the >> previous version.  They are a more powerful, more complicated version, >> but they're still a red-herring. > > Can you elaborate on this ? Taking your original concerns: Sure. First of all, I'm not opposed to class based

Re: Pre-filled user info in Django Comments?

2010-12-10 Thread Andre Terra
>From my experience, adapting to http://code.google.com/p/django-threadedcomments/ pays off. You said "the site I'm *building*", and we all know it's definitely easier to explore other possibilities early on. Best regards, Andre Terra (airstrike) On Fri, Dec 10, 2010 at 14:12, Jeff

Re: Generic Views - do you use them?

2010-12-10 Thread Łukasz Rekucki
On 10 December 2010 22:47, Ted Tieken wrote: > Class based generic views still have the major drawbacks of the > previous version.  They are a more powerful, more complicated version, > but they're still a red-herring. Can you elaborate on this ? Taking your original

Re: Generic Views - do you use them?

2010-12-10 Thread Ted Tieken
Class based generic views still have the major drawbacks of the previous version. They are a more powerful, more complicated version, but they're still a red-herring. Ted On Fri, Dec 10, 2010 at 9:37 AM, Rainy wrote: > On Dec 10, 4:04 am, Łukasz Rekucki

Calling a mssql stored procedure and displaying the result as a datagrid

2010-12-10 Thread Pranav
Hi all, I'm new to django and sorry if my questions are too basic. I have a some requirements 1. I have a stored procedure in my mssql database server and i would like to call the procedure in my program with certain parameters.(Is there a way the results of the stored procedure be represented

Re: Generic Views - do you use them?

2010-12-10 Thread Rainy
On Dec 10, 4:04 am, Łukasz Rekucki wrote: > You should try the new class-based generic > views:http://docs.djangoproject.com/en/dev/topics/class-based-views/ > > They're much more flexible. Is there a doc somewhere that details what the limitations are? How do you tell if

Re: Pre-filled user info in Django Comments?

2010-12-10 Thread Jeff
My site takes the route of hiding name, email, and URL fields for authenticated users. You can safely serve up a form without the name field for authenticated users since the comments framework will just copy over either the user's full name if it's set or their username if it isn't for the

Re: Limit number of concurrent non-admin/non-superuser users

2010-12-10 Thread Daniel Roseman
On Dec 10, 3:07 pm, Stodge wrote: > I'm trying to limit the number of concurrent users attached to my > Django website. For example I need to implement a floating license > system. I've seen a few snippets but so far I think they all implement > a middleware. I'm trying to avoid

Re: django session InvalidOperation

2010-12-10 Thread kinder
After some more futzing around this morning, I'm thinking this might be a shared library version mismatch, maybe with the MySQL client shared libraries? How can I find out what version django/python is using? -- You received this message because you are subscribed to the Google Groups "Django

Limit number of concurrent non-admin/non-superuser users

2010-12-10 Thread Stodge
I'm trying to limit the number of concurrent users attached to my Django website. For example I need to implement a floating license system. I've seen a few snippets but so far I think they all implement a middleware. I'm trying to avoid using a middleware because I don't want the overhead on

Re: SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?

2010-12-10 Thread Stodge
Ok thanks. I'm trying to limit the number of concurrent users using sessions. -- 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

Re: django session InvalidOperation

2010-12-10 Thread kinder
At least superficially, it looks like MySQLDB is working ok - a row does end up inserted in the django_session table. The reason I am looking in /usr/local/lib/python2.5/site-packages/django/db/models/ query.py around line 317 is because (according to the interactive stack trace) that is where the

Re: SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?

2010-12-10 Thread Matthias Runge
AFAIK there is a known bug in FireFox preventing it from working correctly. Try (nearly) any other browser. "Stodge" schrieb: >I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings. >When the user visits my custom login page a new session is created for >them in

Re: SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?

2010-12-10 Thread Tom Evans
On Fri, Dec 10, 2010 at 1:27 PM, Stodge wrote: > I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings. > When the user visits my custom login page a new session is created for > them in the database. The expiry time is set to two weeks. > > If I then close the

Dump & load: sqlite to poastgres

2010-12-10 Thread TomPH
What is the best practise to migrate the data from sqllite to postgres? All tries I had till now failed with DB key errors! What I did: 1) python manage.py dumpdata --indent 3 -n >../dev_data.json (dev. system) 2) python manage.py flush (production) no creation of superusers (but this doesn't

SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?

2010-12-10 Thread Stodge
I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings. When the user visits my custom login page a new session is created for them in the database. The expiry time is set to two weeks. If I then close the browser, the expiry hour/minute are adjusted but it's still set to two weeks in

Re: Newbie question: many-to-many model creation

2010-12-10 Thread Marcos Moyano
http://www.djangoproject.com/documentation/models/many_to_many/ Rgds, Marcos On Fri, Dec 10, 2010 at 8:54 AM, girish shabadimath < girishmss.1...@gmail.com> wrote: > Thanks for the reply,, > Here are my models > > class Checkers(models.Model): >name = models.CharField(max_length = 100) >

Re: Newbie question: many-to-many model creation

2010-12-10 Thread girish shabadimath
Thanks for the reply,, Here are my models class Checkers(models.Model): name = models.CharField(max_length = 100) weight = models.FloatField(default = 0) desc = models.CharField(max_length = 1000) class PrepCheckers(models.Model): name = models.CharField(max_length = 150)

Re: File upload fail on live server

2010-12-10 Thread Sithembewena Lloyd Dube
Good idea, Kenneth. I will do so. Thanks. On Fri, Dec 10, 2010 at 8:00 AM, Kenneth Gonsalves wrote: > On Thu, 2010-12-09 at 14:57 +0200, Sithembewena Lloyd Dube wrote: > > Thanks Kenneth. I tried your recommendation, the file is not uploaded > > at > > all. I'm stumped by

Re: Newbie question: many-to-many model creation

2010-12-10 Thread Kenneth Gonsalves
On Fri, 2010-12-10 at 16:55 +0530, girish shabadimath wrote: > im new to django > > im using django 1.2 > i have a model that has one many-to-many relationship field > > How to create a object of this model ? > > what to pass for the field that has many-to-many relationship? please give some

Newbie question: many-to-many model creation

2010-12-10 Thread girish shabadimath
Hi all, im new to django im using django 1.2 i have a model that has one many-to-many relationship field How to create a object of this model ? what to pass for the field that has many-to-many relationship? -- Girish M S -- You received this message because you are subscribed to the Google

Re: Beta page and "under construction"

2010-12-10 Thread Álex González
Lot of thanks for your idea Christophe! I made this simple middleware: from django.http import HttpResponseRedirect class BetaOrSplash(object): allowed_ips = ['87.220.133.214', '127.0.0.1'] def process_request(self, request): if request.META['REMOTE_ADDR'] in self.allowed_ips:

Re: __init__.py file executed twice ?

2010-12-10 Thread Mike Dewhirst
On 10/12/2010 7:43pm, martvefun wrote: On 09-12-10 01:37, Mike Dewhirst wrote: It seems like a good place to put it. Maybe you can test to see if the threads have been started already? Here is a singleton which could live in your __init__.py and might help to record the state of your threading

Re: problem writing a unittest

2010-12-10 Thread Kenneth Gonsalves
On Fri, 2010-12-10 at 00:19 -0800, Daniel Roseman wrote: > The setup method should be spelled "setUp". Unittest is a descendant > of Java's jUnit and inherits its naming conventions, unfortunately. thanks - reminder to self: never type anything when it is possible to copy-paste -- regards

Re: Generic Views - do you use them?

2010-12-10 Thread Łukasz Rekucki
You should try the new class-based generic views: http://docs.djangoproject.com/en/dev/topics/class-based-views/ They're much more flexible. On 10 December 2010 02:44, Rainy wrote: > On Nov 8, 6:42 pm, Ted wrote: >> What are their pros and cons?  How

Re: __init__.py file executed twice ?

2010-12-10 Thread martvefun
On 09-12-10 01:37, Mike Dewhirst wrote: > It seems like a good place to put it. Maybe you can test to see if the > threads have been started already? > > Here is a singleton which could live in your __init__.py and might > help to record the state of your threading ... or anything else for > that

Re: Help for for loop

2010-12-10 Thread Steve Holden
On 12/9/2010 12:24 PM, Cal Leeming [Simplicity Media Ltd] wrote: > Uh, you *might* be able to use: > > {% for x in mylist %} > {% if x % 2 %} > yay: {{x}} > {% else %} > nay: {{x}} > {% endif %} > {% endfor %} > Blerch! This is a really good indication of why it's

Re: problem writing a unittest

2010-12-10 Thread Daniel Roseman
On Dec 10, 6:53 am, Kenneth Gonsalves wrote: > hi, > > I am trying to write a unittest, but am getting an error. > > django version - trunk > model: > > class Nums(models.Model): > >     num1 = models.IntegerField("First number") >     num2 = models.IntegerField("Second