On 14/02/2017 12:14 PM, Melvyn Sopacua wrote:

P.S. I left two bugs in there, for now I'll leave them in as an exercise for the reader.


Three bugs ... and 2 questions:

1. You obviously forgot the sugar!

2. With that proportion of Earl Gray the tea would have been far too strong.

3. There might be 5% discrepancy in the total!

Now for the questions ...

class CalculatedPercentageField(models.PositiveSmallIntegerField):
    pct_model = None
    pct_field_name = None

    def __init__(self, pct_model: models.Model, pct_field_name='percentage',
                 *args, **kwargs):
        self.pct_model = pct_model
        self.pct_field_name = pct_field_name
        super().__init__(*args, **kwargs)
    ...


1. What does "pct_model: models.Model," do? I haven't seen that colon before.

2. Will it work when used via the Admin and everything gets saved at once in a single transaction?

Thanks very much for taking all that effort

Cheers

Mike

--

Melvyn Sopacua

--
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+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com <mailto: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/10404615.9y43U2G7Fx%40devstation <https://groups.google.com/d/msgid/django-users/10404615.9y43U2G7Fx%40devstation?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscr...@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/95273247-5aa7-d12f-133c-921a671e179d%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to