Re: newforms question

2008-10-17 Thread Daniel Roseman

On Oct 17, 5:50 pm, Jeff Gentry <[EMAIL PROTECTED]> wrote:
> > Oops. It could also read
> >     from django import newforms as forms
> > in which case you should change it to
> >     from django import forms
>
> Right, that's what I was thinking.
>
> > but I hope you've got the idea: basically newforms has *become* forms.
>
> Yup - just wasn't sure on that.  I had remembered seeing something along
> those lines a while back but wasn't sure if it had said it *was* changing
> names or *wasn't* :)  Plus with all of the chatter on both forms and
> newforms I couldn't find a definitive answer to this question when
> searching.
>
> They have some other "old stuff-isms", some I noticed on my own, some were
> easier to search on and I'm sure I'll come across more.
>
> Thanks all :)
> -J

You might find this page useful:
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges

--
DR.
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms question

2008-10-17 Thread Jeff Gentry

> Oops. It could also read
> from django import newforms as forms
> in which case you should change it to
> from django import forms

Right, that's what I was thinking.

> but I hope you've got the idea: basically newforms has *become* forms.

Yup - just wasn't sure on that.  I had remembered seeing something along
those lines a while back but wasn't sure if it had said it *was* changing
names or *wasn't* :)  Plus with all of the chatter on both forms and
newforms I couldn't find a definitive answer to this question when
searching.

They have some other "old stuff-isms", some I noticed on my own, some were
easier to search on and I'm sure I'll come across more.

Thanks all :)
-J


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms question

2008-10-17 Thread Steve Holden

Jeff Gentry wrote:
> Hi there ...
> 
> To date, I've not been using Django's form system (nor 'newforms'), but am
> trying to integrate another app into a suite that I'm developing.  The
> code on this is a bit older and is using newforms - when I fire up the
> server (running off of the 1.0 branch) I get "No module named
> newforms".  I've been a bit lax in trying to follow how this all shook
> out, but am I correct in my thinking that 'newforms' is now simply
> 'forms'?
> 
Oops. It could also read

from django import newforms as forms

in which case you should change it to

from django import forms

but I hope you've got the idea: basically newforms has *become* forms.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com

--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms question

2008-10-17 Thread Steve Holden

Jeff Gentry wrote:
> Hi there ...
> 
> To date, I've not been using Django's form system (nor 'newforms'), but am
> trying to integrate another app into a suite that I'm developing.  The
> code on this is a bit older and is using newforms - when I fire up the
> server (running off of the 1.0 branch) I get "No module named
> newforms".  I've been a bit lax in trying to follow how this all shook
> out, but am I correct in my thinking that 'newforms' is now simply
> 'forms'?

If the statement that is failing used the recommended mechanism and reads

import django.newforms as forms

then you simply have to change it to

import django.forms

Otherwise you'll have to change every occurrence of "newforms" to
"forms". The code should work, though, modulo any incompatible changes
made to the newforms module before incorporation as the standard package.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms question

2008-10-17 Thread Jeff Anderson
Jeff Gentry wrote:
> Hi there ...
>
> To date, I've not been using Django's form system (nor 'newforms'), but am
> trying to integrate another app into a suite that I'm developing.  The
> code on this is a bit older and is using newforms - when I fire up the
> server (running off of the 1.0 branch) I get "No module named
> newforms".  I've been a bit lax in trying to follow how this all shook
> out, but am I correct in my thinking that 'newforms' is now simply
> 'forms'?
>   
This is correct. oldforms was removed, and newforms was renamed to
forms. This happened before the 1.0 release.

You just need to change your code to reflect this, and it should likely
work.

Jeff Anderson



signature.asc
Description: OpenPGP digital signature


newforms question

2008-10-17 Thread Jeff Gentry

Hi there ...

To date, I've not been using Django's form system (nor 'newforms'), but am
trying to integrate another app into a suite that I'm developing.  The
code on this is a bit older and is using newforms - when I fire up the
server (running off of the 1.0 branch) I get "No module named
newforms".  I've been a bit lax in trying to follow how this all shook
out, but am I correct in my thinking that 'newforms' is now simply
'forms'?


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms question with multiple object types in the same form

2007-10-02 Thread Fred Palmer
Thanks... I think that might be it!

On 10/2/07, Doug B <[EMAIL PROTECTED]> wrote:
>
>
> Search for 'prefix' in the regression tests, that does what you want.
> Doesn't seem to be in the docs.
>
>
> http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/forms.py
>
>
>
> >
>


-- 
Fred Palmer | Senior Software Engineer
615.653.7228 | www.studionow.com

--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms question with multiple object types in the same form

2007-10-02 Thread Doug B

Search for 'prefix' in the regression tests, that does what you want.
Doesn't seem to be in the docs.

http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/forms.py



--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms question with multiple object types in the same form

2007-10-02 Thread Fred Palmer
Hi,

I'm looking for the recommended way of handling this.  I have some models
like so:

class ContactInfo(models.Model):
uuid= UUIDField('UUID', blank=False, maxlength=50,
core=True, unique=True, editable=False)
first_name  = models.CharField(blank=True, maxlength=20)
last_name   = models.CharField(blank=True, maxlength=20)
address1= models.CharField(blank=True, maxlength=100)

class TestProfile( models.Model):
uuid= UUIDField('UUID', blank=False, maxlength=50,
core=True, unique=True, editable=False)
website_name= models.CharField(blank=False, null=True,
maxlength=100)
number_of_employees = models.IntegerField(blank=False, null=True)
primary_contact_info= models.ForeignKey(ContactInfo,
related_name='primary_address', blank=False, null=True)
secondary_contact_info  = models.ForeignKey(ContactInfo,
related_name='payee_address', blank=False, null=True)

I want to be able to simply call the form_for_model function and get a form
for the TestProfile but this doesn't work out of the box if you are
submitting all new data for the contact fields.

So the question is how is this normally done?  Doesn't seem possible with
using auto_id to distinguish the two ContactInfo fields of TestProfile in
the form since the "name" attribute is still the same.

--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: NewForms Question..

2007-04-11 Thread brad

You are exactly right. Thanks for your time and help.


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: NewForms Question..

2007-04-10 Thread Russell Keith-Magee

On 4/11/07, brad <[EMAIL PROTECTED]> wrote:
>
> Hello, I am using NewForms with my current Django project, but I am
> stumped on one error message. Here's the error message: Cannot resolve
> keyword 'organization' into field.

Without knowing your model definitions, this is a guess, but I'd say
this line is your problem:

> organization
> =Organization.objects.get(organization__exact=


Does your Organization model have a field called organization? The
error message is telling you that it can't find a model field called
organization. I'm guessing what you're looking for here is
Organization.objects.get(id=...), or something similar.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



NewForms Question..

2007-04-10 Thread brad

Hello, I am using NewForms with my current Django project, but I am
stumped on one error message. Here's the error message: Cannot resolve
keyword 'organization' into field. I am assuming that there is
something wrong in my forms.py file in the application folder. Here's
what I have in forms.py, and thank you for taking the time to read
this post:

from django.contrib.auth.models import User
from models import Organization, UserProfile, Game
from django import newforms as forms
from django.newforms import widgets

class Register(forms.Form):
username = forms.CharField(max_length=40)
email = forms.EmailField()
password1 = forms.CharField(max_length=40)
password2 = forms.CharField(max_length=40)
organization = forms.CharField(max_length=40)


def clean_username(self):
"""
Validates that the username is not already in use.

"""
try:
user =
User.objects.get(username__exact=self.clean_data['username'])
except User.DoesNotExist:
return self.clean_data['username']
raise forms.ValidationError(u'The username "%s" is already
taken. Please pick a different
  username.' %
self.clean_data['username'])



def clean_email(self):
"""
Validates that the email is not already in use.

"""
try:
email =
User.objects.get(email__exact=self.clean_data['email'])
except User.DoesNotExist:
return self.clean_data['email']
raise forms.ValidationError(u'The email "%s" is already taken.
Please pick a different
  email.' %
self.clean_data['email'])


def clean_password2(self):
"""
Validates that the two password inputs match.

"""
if(self.clean_data.get('password1') !=
self.clean_data.get('password2')):
raise forms.ValidationError(u'The password does not match
above')
return self.clean_data['password2']


def clean_organization(self):
"""
Validates that the organization exists.

"""
try:
organization
=Organization.objects.get(organization__exact=
 
self.clean_data['organization'])
except Organization.DoesNotExist:
return self.clean_data['organization']
raise forms.ValidationError(u'The organization "%s" does not
exist. Please pick one that
 does exist.' %
self.clean_data['organization'])


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms question: select widget

2007-02-21 Thread [EMAIL PROTECTED]

I just want to render a formfield as a select field without having to
create a Form class.

Why does this not work?

from django import newforms as forms
ConfForm = forms.models.form_for_model(Conference)
form = ConfForm()
choices = (
('Monday','Monday',),
('Tuesday','Tuesday',),
('Wednesday','Wednesday',),
('Thursday','Thursday',),
('Friday','Friday',),
('Saturday','Saturday',),
('Sunday','Sunday',)
)
day_of_week = forms.Select('day_of_week')
day_of_week.render('day_of_week','Monday',None,choices)

exceptions.ValueErrorTraceback (most
recent call last)

blah...blah...

ValueError: dictionary update sequence element #0 has length 1; 2 is
required


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---