Re: Have a look at django.newforms

2007-01-10 Thread serbaut
Ok, thank you for the answer. I am using newforms with an older django codebase so thats why I ran into this. On Jan 9, 3:38 pm, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > On 1/9/07, serbaut <[EMAIL PROTECTED]> wrote: > > > fields.py tries to get settings.URL_VALIDATOR_USER_AGENT with: > > >

Re: Have a look at django.newforms

2007-01-09 Thread Nicola Larosa (tekNico)
Adrian Holovaty wrote: > The try/except in this case is meant to handle the case in which > somebody is using newforms without the rest of Django, which was an > early goal of mine. Since then, I've sort of resigned myself to > requiring Django, due to ties into the internationalization hooks and

Re: Have a look at django.newforms

2007-01-09 Thread Adrian Holovaty
On 1/9/07, serbaut <[EMAIL PROTECTED]> wrote: > fields.py tries to get settings.URL_VALIDATOR_USER_AGENT with: > > try: > from django.conf import settings > URL_VALIDATOR_USER_AGENT = settings.URL_VALIDATOR_USER_AGENT > except ImportError: > # It's OK if Django settings aren't configur

Re: Have a look at django.newforms

2007-01-09 Thread serbaut
fields.py tries to get settings.URL_VALIDATOR_USER_AGENT with: try: from django.conf import settings URL_VALIDATOR_USER_AGENT = settings.URL_VALIDATOR_USER_AGENT except ImportError: # It's OK if Django settings aren't configured. URL_VALIDATOR_USER_AGENT = 'Django (http://www.djan

Re: Have a look at django.newforms

2007-01-08 Thread Benjamin Slavin
Adrian, I think rassilon is talking about something like "help_text". I've seen this discussed before... both here and on django-users. As a result, I've created a patch that has been posted to trac. [1] -Ben [1] http://code.djangoproject.com/ticket/3255 On 1/8/07, Adrian Holovaty <[EMAI

Re: Have a look at django.newforms

2007-01-08 Thread Adrian Holovaty
On 1/8/07, rassilon <[EMAIL PROTECTED]> wrote: One issue i have with new forms is that there is no detail/description space for the forms, it would be really useful, since at the moment, rather than being able to use the automatic generation methods, i have to write custom templates for each for

Re: Have a look at django.newforms

2007-01-08 Thread rassilon
One issue i have with new forms is that there is no detail/description space for the forms, it would be really useful, since at the moment, rather than being able to use the automatic generation methods, i have to write custom templates for each form with the labels in (or use an ugly hack to pul

Re: Have a look at django.newforms

2006-12-05 Thread Adrian Holovaty
On 12/5/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > Adrian Holovaty wrote: > > This is an interesting problem. That template fix would be OK by me, > > but it's sort of a hack. I think we're going to run into similar > > issues with Form.__str__() returning a Unicode object. Maybe, as you > > s

Re: Have a look at django.newforms

2006-12-05 Thread Ivan Sagalaev
Adrian Holovaty wrote: > This is an interesting problem. That template fix would be OK by me, > but it's sort of a hack. I think we're going to run into similar > issues with Form.__str__() returning a Unicode object. Maybe, as you > suggest, Form.__str__() should return a bytestring according to

Re: Have a look at django.newforms

2006-12-05 Thread gabor
Adrian Holovaty wrote: > On 12/1/06, Gábor Farkas <[EMAIL PROTECTED]> wrote: >> what about the following change?: >>> if not isinstance(output, basestring): >>> -return str(output) >>> +try: >>> +return str(output) >>> +except UnicodeEnc

Re: Have a look at django.newforms

2006-12-05 Thread Adrian Holovaty
On 12/1/06, Gábor Farkas <[EMAIL PROTECTED]> wrote: > what about the following change?: > > if not isinstance(output, basestring): > > -return str(output) > > +try: > > +return str(output) > > +except UnicodeEncodeError: > > +

Re: Have a look at django.newforms

2006-12-02 Thread [EMAIL PROTECTED]
On Nov 30, 6:31 pm, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > The django.newforms library is getting more solid by the day, and I'm > using it for some personal and work projects. Real-world use has > helped me find and fix problems with it, and I'm pretty happy with how > things have turned

Re: Have a look at django.newforms

2006-12-01 Thread Brantley Harris
Another (sorry, I'm pretty sure this is my last today). A label keyword would be great for specifying the label for the field. password2 = CharField(widget=PasswordInput, label="Password (again):") Would render: Password (again): --~--~-~--~~~---~--~~ You recei

Re: Have a look at django.newforms

2006-12-01 Thread Brantley Harris
One other thing: -- newforms/forms.py - line 40 -- def __init__(self, data=None, auto_id=False): # TODO: prefix stuff self.ignore_errors = data is None Change to: def __init__(self, data=None, auto_id=False): # TODO: prefix stuff self.ignore_errors = not bool(data) That way yo

Re: Have a look at django.newforms

2006-12-01 Thread Honza Král
On 12/1/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > > Honza Král wrote: > > I get a ProgrammingError, the SQL command is missing quotes around the > > value in question. I worked around this using str( > > form.clean()['form_field'] ), but that doesn't strike me as very nice. > > As far as I rem

Re: Have a look at django.newforms

2006-12-01 Thread Brantley Harris
Awesome. I approve. I'm warming to the whole "Widget" thing. Although I hate that name, as it's specifically nondescript, I can't think of another. Some comments: I'd like to see auto_id default to "id_%s" rather than False. Why not just give it as the default? I love clean_XXX(), and clean()

Re: Have a look at django.newforms

2006-12-01 Thread Adrian Holovaty
On 12/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > If there's one more suggestion that I can make...when creating models, > there's a separate CharField and TextField. In newforms, it seems that > there's no such distinction, so an as_textarea function determines its > display (if I'm see

Re: Have a look at django.newforms

2006-12-01 Thread [EMAIL PROTECTED]
Adrian Holovaty wrote: > I think you may be missing something. :) A Form is a collection of > Fields, which are validation / data types. Each Field has a Widget, > which is an HTML representation of the field. Got it now, thanks, and newforms is really shaping up to be great. :) If there's one m

Re: Have a look at django.newforms

2006-12-01 Thread Adrian Holovaty
On 12/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Maybe I'm missing something, but is there any way to associate a Widget > with a Form, or do those need to be instantiated separately? > > In all of the unit tests, the Forms only consist of a collection of > Fields, but in almost every us

Re: Have a look at django.newforms

2006-12-01 Thread [EMAIL PROTECTED]
Adrian Holovaty wrote: > So, then, I'd encourage everybody to play around with django.newforms > and post a message if you have any issues or thoughts. There is no > formal documentation, but the unit tests are *quite extensive* and > serve as pretty good documentation. The unit tests live in the

Re: Have a look at django.newforms

2006-12-01 Thread Gábor Farkas
Adrian Holovaty wrote: > On 11/30/06, gabor <[EMAIL PROTECTED]> wrote: >> but if i want to render it in a template and it contains non-ascii text, >> it fails in /home/gabor/src/django/django/template/__init__.py, >> line 745, UnicodeEncodeError. >> >> the code there calls str() on the form, and i

Re: Have a look at django.newforms

2006-11-30 Thread Ivan Sagalaev
Honza Král wrote: > I get a ProgrammingError, the SQL command is missing quotes around the > value in question. I worked around this using str( > form.clean()['form_field'] ), but that doesn't strike me as very nice. As far as I remember psycopg2 does correctly accept unicode strings. You can ju

Re: Have a look at django.newforms

2006-11-30 Thread Adrian Holovaty
On 11/30/06, Honza Král <[EMAIL PROTECTED]> wrote: > great work on those forms, I really like them, thanks. > I am currently using them for a few projects and am delighted with them. > > I am also facing some UNICODE issues, when saving into a database > (postgres), the backend fails to quote the

Re: Have a look at django.newforms

2006-11-30 Thread Adrian Holovaty
On 11/30/06, gabor <[EMAIL PROTECTED]> wrote: > but if i want to render it in a template and it contains non-ascii text, > it fails in /home/gabor/src/django/django/template/__init__.py, > line 745, UnicodeEncodeError. > > the code there calls str() on the form, and it's a problem because it > cal

Re: Have a look at django.newforms

2006-11-30 Thread Honza Král
Hi Adrian, great work on those forms, I really like them, thanks. I am currently using them for a few projects and am delighted with them. I am also facing some UNICODE issues, when saving into a database (postgres), the backend fails to quote the values from the form correctly (field is a charfie

Re: Have a look at django.newforms

2006-11-30 Thread gabor
Adrian Holovaty wrote: > Hi all, > > The django.newforms library is getting more solid by the day, and I'm > using it for some personal and work projects. Real-world use has > helped me find and fix problems with it, and I'm pretty happy with how > things have turned out. > > So, then, I'd encou