In MyModelB, at least, the subclass' refresh method would win, since it's the 
subclass.

I'm not sure about MyModelA, since I am not quite sure how the metaclass' 
processing would intersect.

That said, if there's demand for the feature, it's probably worth this cost. 
(Bias: I would use it if it existed, although my use case differs from the 
discussion here.)

Sent from my iPad

On May 12, 2013, at 2:13 PM, Tim Chase <[email protected]> wrote:

> On 2013-05-11 18:36, Anssi Kääriäinen wrote:
>> On 12 touko, 02:55, Russell Keith-Magee <[email protected]>
>>> What is on the table is essentially adding a refresh() call on an
>>> object instance that is an API analog of
>>> ".get(id=self.id)"
> 
> I guess my minor quibble is about the name itself and possible
> clashes with existing fields/methods:
> 
>  class MyModelA(Model):
>    # ...
>    refresh = BooleanField(...)
>    # ...
>  class MyModelB(Model):
>    # ...
>    def refresh(...): do_something_refreshing()
>    # ...
> 
>  a = MyModelA.objects.get(pk=some_id)
>  b = MyModelB.objects.get(pk=other_id)
>  # ...
>  if a.refresh: # legacy code expects a BooleanField
>    # whoops, what happens here under this proposal?
>  if b.refresh(): # legacy code expects local logic, not Django logic
>    # or what gets called here?
> 
> I wouldn't want to see any breakage when upgrading between versions.
> I don't have a good proposal, other than perhaps _refresh() or
> __refresh__(), or cramming it into Meta (I don't know if that would
> even work).
> 
> -tkc
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-developers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to