using defaultdict on django

2007-08-24 Thread james_027
hi, I am using defaultdict to gather organize some data on request.POST. but the result seems to be different when execute outside django ... inside django I could get this result ... {u'item': [u'727'], u'unit_price': [u'5.50'], u'qty': [u'']} {u'item': [u'2'], u'unit_price': [u'23500.00'], u'

Help needed

2007-08-24 Thread Ani Nair
Hi I'm new to this.. I want to know whether django restricts the use of '?' in urls. I am unable to use it in the url config --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

floatformat builtin filter broken by null

2007-08-24 Thread baudmap
Hi I'm running the SVN version & getting an "Caught an exception while rendering: float() argument must be a string or a number" when {{ best_avg_reliability|floatformat:1 }} receives a null value. Do you think this a bug ? Thanks, greg --~--~-~--~~~---~--~~ Yo

menu application

2007-08-24 Thread Rob Slotboom
For a given django site there are many urls.py's. The system also knows what apps are installed. Wouldn't it be nice to make an app that uses this knowledge and add some extra functionality to manage a website menu? At the moment I have no idea how to implement it but it should be something websi

Re: Help needed

2007-08-24 Thread james_027
Hi ani, On Aug 24, 3:42 pm, Ani Nair <[EMAIL PROTECTED]> wrote: > Hi I'm new to this.. I want to know whether django restricts the use > of '?' in urls. I am unable to use it in the url config My guess is that "?" is a special char in regex which django uses in url config... try to escape it. Ho

admin raises IndexError when there are no fields to edit

2007-08-24 Thread omat
When I try to manipulate data of the following model: class Bulletin(models.Model): created = models.DateTimeField(editable=False) def save(self): self.created = datetime.now() super(Bulletin, self).save() class Admin: pass Admin raises the following except

Re: Help needed

2007-08-24 Thread Ben van Staveren
On 24/08/2007, at 3:03 PM, james_027 wrote: > > Hi ani, > > On Aug 24, 3:42 pm, Ani Nair <[EMAIL PROTECTED]> wrote: >> Hi I'm new to this.. I want to know whether django restricts the use >> of '?' in urls. I am unable to use it in the url config > > My guess is that "?" is a special char in reg

Re: Help needed

2007-08-24 Thread Paul Rauch
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 james_027 schrieb: > Hi ani, > > On Aug 24, 3:42 pm, Ani Nair <[EMAIL PROTECTED]> wrote: >> Hi I'm new to this.. I want to know whether django restricts the use >> of '?' in urls. I am unable to use it in the url config > > My guess is that "?" is a

Re: learning django, strange problem with admin

2007-08-24 Thread Timothy Kanters
> Some may suggest that you set maximum number of requests per Apache > child to 1. This however is a rather brute force approach and if doing > that you may as well use CGI. Aye, but for my development server that is quite ok, easier to do than restarting apache after every change :) Thanks for

Re: learning django, strange problem with admin

2007-08-24 Thread Graham Dumpleton
On Aug 24, 6:33 pm, "Timothy Kanters" <[EMAIL PROTECTED]> wrote: > > Some may suggest that you set maximum number of requests per Apache > > child to 1. This however is a rather brute force approach and if doing > > that you may as well use CGI. > > Aye, but for my development server that is quite

Singleton + Django problem

2007-08-24 Thread Rodrigue
Hi, I am developing an application based on django that also uses some python modules I have written. My problem is that I need one of my classes to be a singleton. I use this code to do it (mix of Borg and singleton): class SomeClass: _shared_state = {} def __init__(self): self.__dict

Re: admin raises IndexError when there are no fields to edit

2007-08-24 Thread Russell Keith-Magee
On 8/24/07, omat <[EMAIL PROTECTED]> wrote: > > IndexError: list index out of range This is a known problem, detailed in #4621. There isn't a lot of core developer effort going into fix the many known problems with the existing admin application because it is due to be replaced very soon (with t

'str' object is not callable - Changing Form object in a view

2007-08-24 Thread Tipan
I have a series of on-line questionnaires, each has a separate Form class defined because the question types and data types for the responses are always different. I'd like to be able to set the form that is used in the view based on an ID parameter passed to the view. However, whatever I try, I

CheckboxField problem when not ticked

2007-08-24 Thread vanderkerkoff
hello everyone. I'm using a manipulator in an applications view file. class RegistrationManipulator(AuthenticationForm): def __init__(self, request): AuthenticationForm.__init__(self, request) self.fields = ( forms.TextField(field_name="username", is_required=True

Re: Unicode error

2007-08-24 Thread sandro.fernandes
Changed mysql db Collation to utf8_unicode_ci and the error was gone ! thanks yours, Sandro Thomas Guettler wrote: > Am Mittwoch, 22. August 2007 19:25 schrieb Sandro Fernandes: > >> Hi all , >> >> I runing Django from the trunk and getting the error bellow , this >> happens when a da

Re: CheckboxField problem when not ticked

2007-08-24 Thread Matt Davies
carole, thanks rather than checking the value, check it's there first :-) you're a star On 24/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I believe that when a checkbox is not 'checked' it will not be in your > request object ... > so: > > if data.has_key('s_cymru'): ># it is

Re: CheckboxField problem when not ticked

2007-08-24 Thread [EMAIL PROTECTED]
I believe that when a checkbox is not 'checked' it will not be in your request object ... so: if data.has_key('s_cymru'): # it is checked else: # not checked On Aug 24, 9:28 am, vanderkerkoff <[EMAIL PROTECTED]> wrote: > hello everyone. > > I'm using a manipulator in an applications view f

Free Django application hosting?

2007-08-24 Thread Stodge
I'm developing a couple of ideas and I need other people's input. The applications are currently on my development PC at home. Are there any sites that offer free Django application hosting (not source)? The apps would have user accounts so only people I give access to can access them - everyone e

Re: UnicodeEncodeError in template rendering

2007-08-24 Thread Michael Radziej
Hi, On Sun, Aug 19, Malcolm Tredinnick wrote: > > On Sun, 2007-08-19 at 00:27 -0700, cesco wrote: > > File "C:\Python25\lib\site-packages\django\template\__init__.py" in > > render > > 739. return ''.join([force_unicode(b) for b in bits]) ^^^ Malcolm: shouldn't this be u''.j

Re: Free Django application hosting?

2007-08-24 Thread Tim Chase
> I'm developing a couple of ideas and I need other people's > input. The applications are currently on my development PC at > home. Are there any sites that offer free Django application > hosting (not source)? I don't believe I've come across any such generous soul. Likely, your best option is

Re: floatformat builtin filter broken by null

2007-08-24 Thread Masida
Hi Greg, Strictly speaking None ain't a number (nor a float), so it probably isn't a bug. Although it might be convenient at times to automatically convert None to 0 (as in your case). A simple workaround I always use is: {{ best_avg_reliability|default:0|floatformat:1 }} Greetings, - Matthias

Any way to re-synch database when I change models.py without deleting the DB?

2007-08-24 Thread Stodge
While prototyping my models.py, I often have tweak it to try different ideas out. This means I have to wipe the whole database and rerun manage syncdb - and I have to re-enter the admin information. Is there an easy way to re-synch the database without wiping it so it can somehow apply the SQL ch

Re: Free Django application hosting?

2007-08-24 Thread Stodge
Thanks - I took a look, but it's French so it'll take me a while to see what they offer and how to us them. On Aug 24, 10:44 am, Amirouche <[EMAIL PROTECTED]> wrote: > On Aug 24, 3:49 pm, Stodge <[EMAIL PROTECTED]> wrote: > > > I'm developing a couple of ideas and I need other people's input. The

Re: floatformat builtin filter broken by null

2007-08-24 Thread baudmap
In my case zero isn't appropriate for null but I don't think it should cause a page rendering exception. Thanks for the workaround, I'll go with something like that. Cheers, Greg On Aug 24, 4:15 pm, Masida <[EMAIL PROTECTED]> wrote: > Hi Greg, > > Strictly speaking None ain't a number (nor a fl

Re: Free Django application hosting?

2007-08-24 Thread Amirouche
On Aug 24, 3:49 pm, Stodge <[EMAIL PROTECTED]> wrote: > I'm developing a couple of ideas and I need other people's input. The > applications are currently on my development PC at home. Are there any > sites that offer free Django application hosting (not source)? The > apps would have user accou

Injecting validation errors into newforms

2007-08-24 Thread Kirk Strauser
I'm using newforms to create self-validation input forms on my site. The problem I'm running into is that I'd really, really like to be able to associate errors from the form.clean() stage of validation with the fields that are actually having problems. For example, I'd like something like:

Re: Any way to re-synch database when I change models.py without deleting the DB?

2007-08-24 Thread [EMAIL PROTECTED]
I always just go to mysql and use Alter Table commands via the command line .. to sync it up to whatever changes I've made. On Aug 24, 10:50 am, Stodge <[EMAIL PROTECTED]> wrote: > While prototyping my models.py, I often have tweak it to try different > ideas out. This means I have to wipe the wh

Re: Any way to re-synch database when I change models.py without deleting the DB?

2007-08-24 Thread Adam Fast
You can either manually make the change with your 4# admin utility, or look at the schema-evolution branch. Just searching this group for that term will provide a world of information. I've not kept up on it's status, but you can find it easily. On 8/24/07, Stodge <[EMAIL PROTECTED]> wrote: > > W

Re: Singleton + Django problem

2007-08-24 Thread James Bennett
On 8/24/07, Rodrigue <[EMAIL PROTECTED]> wrote: > This works fine when I unittest it. But then, I create an instances of > SomeClass in Django and...it does not work...and in the strangest way: > the rest of the initialisation code is executed more than once, but > not everytime. When running und

Re: Any way to re-synch database when I change models.py without deleting the DB?

2007-08-24 Thread James Bennett
On 8/24/07, Stodge <[EMAIL PROTECTED]> wrote: > Is there an easy way to re-synch the database without wiping it so it > can somehow apply the SQL changes automatically? Yes, it's called "ALTER TABLE". No, there's nothing contradictory in providing an ORM without providing automated schema migrat

Inheriting blocks inside custom template tags

2007-08-24 Thread Filipe Correia
I'm using a custom templatetag, named "ifgreaterthan", as seen here: http://nrcfosshelpline.in/code/browser/trunk/web/templatetags/base_utils.py When template inheritance *isn't* used, any {% block xyz %} that exists inside this tag shows correctly on the rendered page. However, if the content of

Re: Flexible Models?

2007-08-24 Thread Nathaniel Martin
Hmmm, that's an interesting method. I was hoping for some way to add attributes though. Does anyone else have any ideas? -Nate On 8/23/07, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > > Am Freitag, 24. August 2007 00:50 schrieb Nathaniel Martin: > > I'm hoping that some of the django experts on

Re: Any way to re-synch database when I change models.py without deleting the DB?

2007-08-24 Thread LorenDavie
You might want to check this out: http://www.aswmc.com/dbmigration/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsub

How can I flush my response stream in django?

2007-08-24 Thread whitesmell
One of my response content was build by several synchronous method, how can I flush my response to client browser as soon as some part of the response content is ready? Most Http response object(both java and .net) has a method flush() to do so . But django's HttpResponse's flush method does n

modeling db inheritance

2007-08-24 Thread Ernesto Rodriguez Reina
Hello, I'm need to model a table inheritance in a new project i'm working on, but i don't know the best way to do it. Here is an explample of what i need: class User(models.Model): firstname = models.CharField(maxlength=100) lastname = models.CharField(maxlength=100) # This s

Re: Importing Excel/CVS into Database

2007-08-24 Thread robo
Good news guys, this code is working for me: import MySQLdb import csv def imports(): db = MySQLdb.connect(user='...', db='...', passwd='...', host='...') cursor = db.cursor() file = "C:\\test_import.txt" for i, line in enumerate(open(file)): if i == 0: continue data_first,

Re: modeling db inheritance

2007-08-24 Thread Lic. José M. Rodriguez Bacallao
Primero, en django.contrib.auth.models esta definido un modelo User que tiene los datos que necesitas, para eso, debes poner en INSTALLED_APP en tu settings.py la sgte app: django.contrib.auth tu models.py o como se llame debera quedar asi: from django.db import models from django.contrib.auth.mo

Re: How can I flush my response stream in django?

2007-08-24 Thread Jeremy Dunck
On 8/24/07, whitesmell <[EMAIL PROTECTED]> wrote: > > One of my response content was build by several synchronous method, > how can I flush my response to client browser as soon as some part of > the response content is ready? > > Most Http response object(both java and .net) has a method flush

Launch a 'django' enviroment....

2007-08-24 Thread jborup
HI this might be a linux question, more then a django... but I will try.. sorry I'm getting tired of, every time that I want to do some django, to open several shells, and cd... to the directory, open files, launch server... I would like to make a script that opens shells/terminales in t

Re: Importing Excel/CVS into Database

2007-08-24 Thread robo
How would I catch a blank/empty line? I've googled and tried: if not line.strip(): print "skipping blank line" continue if line.strip() == '': print "skipping blank line" continue the script keeps spewing data into the DB, but doesn't seem like its catching blank/empty lines because th

ManyToManyField and order_by

2007-08-24 Thread Viraj Alankar
Hi, I'm trying to do some simple ordering without having to resort to raw sql. Let's say I have models similar to the pizza example in the documentation: class Topping(models.Model): # ... class Pizza(models.Model): # ... toppings = models.ManyToManyField(Topping) I want to get a l

Natural Remedies

2007-08-24 Thread Salah U Shamsi
* A Natural Cure System for your PETS Click to Read: http://homeopet.50webs.com/ -* --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Importing Excel/CVS into Database

2007-08-24 Thread Boris Samorodov
Hi, All! On Fri, 24 Aug 2007 21:05:07 - robo wrote: > How would I catch a blank/empty line? > I've googled and tried: > if not line.strip(): > print "skipping blank line" > continue > if line.strip() == '': > print "skipping blank line" > continue I used to do: - line = line

Re: Importing Excel/CVS into Database

2007-08-24 Thread robo
Wow, your tip works like a charm. Do you personally know of a good tutorial that teaches things like this? I'd like to read them. Thanks, - robo On Aug 24, 2:54 pm, Boris Samorodov <[EMAIL PROTECTED]> wrote: > Hi, All! > > On Fri, 24 Aug 2007 21:05:07 - robo wrote: > > > How would I catch

Re: Launch a 'django' enviroment....

2007-08-24 Thread maxp
jborup wrote: > HI this might be a linux question, more then a django... but I > will try.. sorry > > I'm getting tired of, every time that I want to do some django, to > open several shells, and cd... to the directory, open files, launch > server... > > I would like to make a script that

Re: Importing Excel/CVS into Database

2007-08-24 Thread Boris Samorodov
On Fri, 24 Aug 2007 22:27:13 - robo wrote: > Wow, your tip works like a charm. Glad to be helpful! > Do you personally know of a good tutorial that teaches things like Sorry, I don't. :-( > this? I'd like to read them. WBR -- bsam --~--~-~--~~~---~--~~

Newbie: How to create different person models that share a profile model?

2007-08-24 Thread Ed Hagen
After finally realizing that in django one cannot subclass models, and then reading as much as I could find on alternative approaches, I think I am close to a solution to the following problem, but I can't quite seem to get all the way there on my own: In simplified terms, I want multiple types

Re: Flexible Models?

2007-08-24 Thread r_f_d
I will not say that it is pretty, but, I looked into doing this a while ago for an app I am developing. I wanted to create a system that could inventory and track many different types of assets, and allow for users to essentially create additional asset types on the fly. Essentially, I decided u

Re: Newbie: How to create different person models that share a profile model?

2007-08-24 Thread Ariel Mauricio Nunez Gomez
Hi Ed. I recommend you link all your people roles to a User (It already has Full name and e-mail fields) -- from django.contrib.auth.models import User class Student(models.Model): user = models.ForeignKey(User, unique=True) class Teacher(models.Model): user = models.ForeignKey(User, uni

Re: using defaultdict on django

2007-08-24 Thread james_027
Hi, Anybody has an idea about this? Thanks james On Aug 24, 3:27 pm, james_027 <[EMAIL PROTECTED]> wrote: > hi, > > I am using defaultdict to gather organize some data on request.POST. > but the result seems to be different when execute outside django ... > > inside django I could get this resu

Re: Flexible Models?

2007-08-24 Thread Nathaniel Martin
This looks like exactly what I need. And I wonder if I can through in a few more methods in the attribute model to make forms, etc, a little easier. Thanks! And I'll let you know if I actually get it to work! On 8/24/07, r_f_d <[EMAIL PROTECTED]> wrote: > > > I will not say that it is pretty, but,

Re: Importing Excel/CVS into Database

2007-08-24 Thread Sean Perry
On Aug 24, 2007, at 3:27 PM, robo wrote: > > Wow, your tip works like a charm. > > Do you personally know of a good tutorial that teaches things like > this? I'd like to read them. > 1) read a Python book. Several good ones to choose from. Once you understand how the language works and how to "

TyneMCE-like for math, You know one?

2007-08-24 Thread [EMAIL PROTECTED]
Hi guys, Does anybody here knows a online editor like tinyMCE but for math formulas? What I need: - easy to use - only things like plus, minus, multiplication, division, sum ... not hard stuff like integral Thanks. (I know its a little off-topic but I need that for an related django projec

Can Django be run on 1and1 ?

2007-08-24 Thread john
Can Django be run on a mainstream web hosting company like 1and1.com or does it require a hosting company that specially offers django ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

RE: modeling db inheritance

2007-08-24 Thread Michael Elsdoerfer
I needed a very similar thing and I ultimately decided to use a "type" char field in the base model that would contain the model name of the subtype. Michael > -Original Message- > From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] > On Behalf Of Ernesto Rodriguez Reina > Sent