Beispiel #1
0
 def save(self, commit=True):
     item = super(customerForm, self).save(commit=False)
     item.set_password(self.cleaned_data["password"])
     account = Account(name=self.cleaned_data["name"], access=self.cleaned_data["access"],
                        args2=self.cleaned_data["args2"], num_threads=self.cleaned_data["num_threads"])
     purchase = Purchase(startDate=self.cleaned_data["startDate"], endDate=self.cleaned_data["endDate"],
                         initial=self.cleaned_data["initial"], available=self.cleaned_data["initial"])
     if commit:            
         item.save()
         self.save_m2m()
         
         account.customer = item
         account.save()
         
         purchase.account = account
         purchase.save()    
     return item