This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LotListView(ListView): | |
model = Article | |
context_object_name = 'articles' | |
def get_context_data(self, **kwargs): | |
context = super(LotListView, self).get_context_data(**kwargs) | |
context['articles_data'] = [self._get_article_view_model(a) for a in context['articles']] | |
return context | |
@staticmethod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def yes_or_no(question): | |
reply = str(raw_input(question+' (y/n): ')).lower().strip() | |
if reply[0] == 'y': | |
return True | |
if reply[0] == 'n': | |
return False | |
else: | |
return yes_or_no("Uhhhh... please enter ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multipliers(): | |
return (lambda x: i*x for i in range(4)] | |
print [m(2) for m in multipliers()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: This code was extracted from a larger class and has not been | |
# tested in this form. Caveat emptor. | |
import django.conf | |
import django.contrib.auth | |
import django.core.handlers.wsgi | |
import django.db | |
import django.utils.importlib | |
import httplib | |
import json | |
import logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$values = array( | |
array( | |
'title' => 'Example', | |
'uid' => 1, | |
'created' => REQUEST_TIME, | |
), | |
array( | |
'title' => 'Example 2', | |
'uid' => 1, | |
'created' => REQUEST_TIME, |
NewerOlder