jrief / django-angular

Let AngularJS play well with Django
http://django-angular.awesto.com/
MIT License
1.23k stars 294 forks source link

get_context method on custom Widget is never called #297

Closed craftycorvid closed 7 years ago

craftycorvid commented 7 years ago

If you declare a custom Widget and override the get_context method to add additional attributes, the overridden method is never called, the parent class' get_context method gets called instead.

adrienbrunet commented 7 years ago

Well, @jrief, you could have a look at this SO post. self.__class__ may not refer directly to the class itself but one of its children which can lead to strange behavior or inifinte loop.

Why not using super(TupleErrorList, self) ? Am I missing something ? Was it intended in the first place ?

adrienbrunet commented 7 years ago

@Ivan0xFF Jacob reviewed your PR with a similar comment (see above). Can you update your PR ?

jrief commented 7 years ago

your fix has been integrated in version 1.0.1 and released on PyPI.

Please review PR #303 which will become version 1.1 It has a much cleaner interface for form field inheritance.