OOP noob question: Mixin properties
Dear Python Santa gurus, ;D
I have this Django mixin:
....which is used to override render_to_response() so I can output a
JSON response (the above code is pretty much straight from the Django
The JSONResponseMixin() gets added to my view class like so:
class Api(JSONResponseMixin, BaseDetailView):
Within my the mixins.py file, at the top of the file, I've added these
CACHE_TIMEOUT = 86400 # 24 hours.
CACHE_NAME = 'ad_manager_api'
I'd like to convert those constants to properties and make my
JSONResponseMixin() class more generic and portable.
Django aside, could someone provide OOP Python examples of how I could
instantiate a mixin Class and set/override its properties before
passing data to said mixin?
I hope you don't mind that this question involves Django... I'm just
looking to improve my core Python skills (so, generic Python examples
would be cool).
Many thanks in advance!
|All times are GMT. The time now is 04:34 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.