Re: newForms and self.clean_data

2007-05-18 Thread tyman26

Sorry about that, I probably should of noticed.  Thanks for the info!

On May 18, 12:01 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-05-18 at 09:49 -0700, tyman26 wrote:
> > Hi,
> >   I built an application with the development version of Django and
> > moved it to Apache.  After I moved it, the self.clean_data variable
> > stopped loading for some reason.  I know you have to validate the data
> > before this is availbable, but I am validating it.  It works fine in
> > the development version, but for some reason it doesn't work in
> > Apache.  Is there something I may be missing here?  Any help would be
> > much appreciated.
>
> Sounds like you aren't using the same codebase (for Django) on both
> machines.
>
> We recently renamed clean_data to cleaned_data and there have been at
> least two threads about that on this mailing list and it's mentioned on
> the BackwardsIncompatibleChanges wiki page.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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 and self.clean_data

2007-05-18 Thread Malcolm Tredinnick

On Fri, 2007-05-18 at 09:49 -0700, tyman26 wrote:
> Hi,
>   I built an application with the development version of Django and
> moved it to Apache.  After I moved it, the self.clean_data variable
> stopped loading for some reason.  I know you have to validate the data
> before this is availbable, but I am validating it.  It works fine in
> the development version, but for some reason it doesn't work in
> Apache.  Is there something I may be missing here?  Any help would be
> much appreciated.

Sounds like you aren't using the same codebase (for Django) on both
machines.

We recently renamed clean_data to cleaned_data and there have been at
least two threads about that on this mailing list and it's mentioned on
the BackwardsIncompatibleChanges wiki page.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 and self.clean_data

2007-05-18 Thread tyman26

Hi,
  I built an application with the development version of Django and
moved it to Apache.  After I moved it, the self.clean_data variable
stopped loading for some reason.  I know you have to validate the data
before this is availbable, but I am validating it.  It works fine in
the development version, but for some reason it doesn't work in
Apache.  Is there something I may be missing here?  Any help would be
much appreciated.

Here is the code:
#
view
#
def index(request, customer_no=None):
if request.POST:
InstanceForm = CustomerForm(request.POST)
if InstanceForm.is_valid():
instance = InstanceForm.save(True, customer_no)
return HttpResponseRedirect('/customer/%s' %
instance.customer_no)
else:
if customer_no is not None:
instance = Customer.objects.get(customer_no=customer_no)
InstanceForm = CustomerForm(instance=instance)
else:
InstanceForm = CustomerForm()
return render_to_response('customer/customer_index.html',
  {'form': InstanceForm,
'states':getStates()},
  RequestContext(request))

form

class CustomerForm(forms.Form):
def __init__(self, data=None, auto_id='id_%s', prefix=None,
 initial=None, instance=None):
..

#FUNCTION:
#  Saves the form to customer model
#--returns an instance of a Customer object

def save(self, commit, customer_no):
data_dict = {
'customer_no' : customer_no,
'customer_no_index' : customer_no_index,
'customer_no_group_id' : customer_no_group,
'contact_last' : self.clean_data['contact_last'],
'contact_first' : self.clean_data['contact_first'],
   
}
from main_site.customer.models import Customer
instance = Customer(**data_dict)
if commit:
instance.save()
return instance


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---