ok i understood
thanks for help
On Sunday, April 7, 2019 at 11:58:50 AM UTC+2, Roger Gammans wrote:
-- thanks for help
On Sunday, April 7, 2019 at 11:58:50 AM UTC+2, Roger Gammans wrote:
Omar,When posting question to the list it's good practice to practice tell us a little bit about what your trying to do, and how whatactions cause the error to occur.In this case though you only have a (single line in CalcPoints) which uses the '*' operator.On Sat, 2019-04-06 at 10:35 -0700, omar ahmed wrote:models.pydef CalcPoints(self):return self.won*3 + self.drawThe python documentation has this to say about the '*' operatorThe*(multiplication) operator yields the product of its arguments. The arguments must either both be numbers, or one argument must be an integer and the other must be a sequence. In the former case, the numbers are converted to a common type and then multiplied together. In the latter case, sequence repetition is performed; a negative repetition factor yields an empty sequence.Since you've provided a literal integer ( the '3') as one of your arguments, we can deduce the None valueis in self.won. Since you have 'declared' self.won as an IntegerField; we can see that as in thenormal case we should satisfy the first clause of the reference, "arguments must either both be numbers"however so some reason self.won is None in your case.Without seeing the rest of your code it's impossible to guess accurately but my instinct is your haven'tinitialised your instance from the database (or set a won value when creating the object).If you expected to have a default value you need to set one where you set up self.won seeHTH,--Roger Gammans <rgam...@gammascience.co.uk>
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d152c3b3-591d-4012-b18a-d4014156c8a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment