...
def form_valid(self, form):
data = form.cleaned_data
MoneyTransfer.objects.create(sender=self.get_object(),
receiver=data['receiver'], # ModelChoiceField in the form
total=data['total'], # FloatField in the form, etc.
when=timezone.localtime(timezone.now()),
comment=data['comment'])
return redirect('AccountDetail', self.object.pk)
$order->getPrimaryKey();
$goods = Goods::model()->findByPk($goods_id);
if ( $goods != null) {
$order = new Order();
$order->amount = ->$goods->price;
$order->order_date = Date('Y.m.d');
$order->save();
}