Skip to content

Instantly share code, notes, and snippets.

@Pycz
Created November 24, 2012 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pycz/4140528 to your computer and use it in GitHub Desktop.
Save Pycz/4140528 to your computer and use it in GitHub Desktop.
def b(request):
template = Template('b.html')
test = models.Model()
tread = models.Tread(1, models.now_timestamp())
testlist = test.get_all_records_from(tread)
#testlist = [models.Record(*[x for x in item]) for item in testlist]
context = Context({'lol': testlist})
result = template.render(context)
return HttpResponse(result)
def get_all_records_from(self, tread, board = "B"):
its_records = "records" + board
#its_treads = "treads" + board
self.cur.execute(
"""
SELECT * FROM (%s) WHERE tread_id = (:tread_id)
""" % its_records, {"tread_id": str(tread.id)}
)
return self._list_of_tuple_to_list_of_obj(self.cur.fetchall(), Record)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment