Přejít na obsah
Menu
This question has been flagged
1 Odpovědět
4233 Zobrazení

Hi,

I have been searching everywhere for this answer, but with no luck.

I want to use payslip.date_to.days to get the INT value from the date, to use in a condition for a rule.

I can do it like this:

date_to = str(payslip.date_to)[8:10]

if int(date_to) > 15:

    result = True


And it works! But I was told that is not the correct way to do it "pythonically".

Best way would be simply:

if payslip.date_to.days > 15:
    result = True

But all I get is Wrong python code defined for salary rule.

Avatar
Zrušit
Nejlepší odpověď

Hi Denisse,
only remove the "s" from day:


if payslip.date_to.day > 15:
    result = True


and it will work fine :)

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
led 19
4647
0
bře 23
2404
0
čvc 19
4609
3
čvc 19
6246
0
pro 18
3086