def board(request, name): model = models.Model() all_categorys = model.get_all_categorys() all_boards = [] for category in all_categorys: boards_from = model.get_all_boards_from_category(category) all_boards += boards_from board = model.get_board_by_adr(adr=name) all_treads = model.get_all_treads_by_date(board) class obert(): def __init__(self, mid, name): self.id = mid self.name = name id_all_treads = [x.id for x in all_treads] treads = [] for tread in all_treads: treads.append(obert(tread.id, model.get_all_records_from(tread, board))) template = Template('boards.html') context = Context({'treads': treads, 'board': board, 'all_boards': all_boards}) return HttpResponse(template.render(context))
def b(request): template = Template('b.html') test = models.Model() tread = models.Tread(1, now_timestamp()) testlist = test.get_all_records_from(tread) context = Context({'lol': testlist}) result = template.render(context) return HttpResponse(result)
def index(request): model = models.Model() categ = model.get_all_categorys() newcateg = [] for cat in categ: catboard = model.get_all_boards_from_category(cat) newcateg.append({cat.name: catboard}) template = Template('index.html') con = {"categorys": categ, "categ_list": newcateg, 'welcome_text': 'Welcome back. Again.'} context = Context(con) result = template.render(context) return HttpResponse(result)
def tread(request, board_adr, tread_id): model = models.Model() all_categorys = model.get_all_categorys() all_boards = [] for category in all_categorys: boards_from = model.get_all_boards_from_category(category) all_boards += boards_from board = model.get_board_by_adr(adr=board_adr) tread = model.get_tread_by_id(tread_id, board=board) posts = model.get_all_records_from(tread, board) template = Template('tread.html') context = Context({'board': board,'tread': tread, 'posts': posts, 'all_boards': all_boards}) return HttpResponse(template.render(context))
def test(request): template = Template('addtread.html') context = Context({}) result = template.render(context) return HttpResponse(result)
def faq(request): template = Template('faq.html') context = Context({'s': 'gogog ogogog'}) result = template.render(context) return HttpResponse(result)