Gleber,

I'll try that as well. If I can just figure out how to multiply

total = = new_green.hp_grade * hp_credithours

Where hp_grade is a FloatField (double in the MySQL db) with
hp_credithours which is a DecimalField (decimal in the MySQL db) I
think they'd solve the problem.

On Feb 2, 2:25 pm, Gleber <[email protected]> wrote:
> Try surround the values of the constants with Decimal("x"), like:
>
> APLUS = Decimal("4.33")
> A = Decimal("4")
> AMINUS = Decimal("3.67")
> ...
>
> On Feb 2, 4:58 pm, raj <[email protected]> wrote:
>
>
>
> > To populate a ModelMultipleChoiceField of a ModelForm I'd used a hack
> > similar to Shawn's initial suggestion. So I hope this will work:
>
> > Add to your modelform:
>
> > def __init__(self, whatever_there_are_as_args):
> >     super() # with usual syntax and required_args
> >     if instance is not None and self.initial is not None:
> >         self.initial.update({'hp_grade':instance.hp_grade})
> >     elif instance is not None:
> >         self.initial = {'hp_grade':instance.hp_grade}
>
> > I haven't tested this specific lines but the original code works for
> > me.
>
> > Rajeesh.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
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.

Reply via email to