Exemplo n.º 1
0
def people_ajax_view(request, params):
    context = {}
    pid = params.split("/")
    pid = pid[0]
    person = p.objects.get(pk=pid)
    context["person"] = person
    return_str = render_block_to_string("people_ajax_view.html", "person", context)
    return_str += render_block_to_string("people_ajax_view.html", "buttons", context)
    return HttpResponse(return_str)
Exemplo n.º 2
0
def ajax_view(request, params):
	context = {}
	param = params.split('/')
	i = param[0]
	charfromdb = c.objects.get(pk=i)
	char = character.Character('20', 'temp', 'lol')
	char.fromCharacterDB(charfromdb)
	context['c'] = char
	statMods(char.stats, context)
	return_str = render_block_to_string('char_ajax.html', 'charinfo', context)
	return_str += render_block_to_string('char_ajax.html', 'view', context)
	return HttpResponse(return_str)
Exemplo n.º 3
0
def ajax_encounter(request):
	plevel = request.POST.getlist('level')
	prace = request.POST.getlist('race')
	pname = request.POST.getlist('name')
	pclass = request.POST.getlist('class')
	render_str = ''
	for index, lev in enumerate(plevel):
		name = pname[index] 
		level = plevel[index]
		race = prace[index]
		cclass = pclass[index]
		char = None
		if (cclass == "Fighter"):
			char = fighter.Fighter(level, race, name)
		elif(cclass == "Rogue"):
			char = rogue.Rogue(level, race, name)
		elif(cclass == "Priest"):
			char = priest.Priest(level, race, name)
		elif(cclass == "Mage"):
			char = mage.Mage(level, race, name)
		context = {}
		context['person'] = char
		statMods(char.stats.__dict__, context)
		render_str += render_block_to_string('ajax_enc_char.html', 'encounter', context)
	return HttpResponse(render_str)
Exemplo n.º 4
0
def admin_ajax_character(request):
	name = request.GET['name']
	level = request.GET['level']
	race = request.GET['race']
	cclass = request.GET['class']
	char = None
	if (cclass == "Fighter"):
		char = fighter.Fighter(level, race, name)
	elif(cclass == "Rogue"):
		char = rogue.Rogue(level, race, name)
	elif(cclass == "Priest"):
		char = priest.Priest(level, race, name)
	elif(cclass == "Mage"):
		char = mage.Mage(level, race, name)
	context = {}
	request.session['generated'] = char 
	context['c'] =char 
	statMods(char.stats.__dict__, context)
	return_str = render_block_to_string('char_ajax.html', 'charinfo', context)
	return_str += render_block_to_string('char_ajax.html', 'commit', context)
	return HttpResponse(return_str)
Exemplo n.º 5
0
def ajax_admin_create_encounter(request):
	context = {}
	return_str = render_block_to_string('admin_create_encounter.html', 'character', context)
	return HttpResponse(return_str)
Exemplo n.º 6
0
def ajax_create_sheet(request):
	context = {}
	return_str = render_block_to_string('admin_create.html', 'sheet', context)
	return HttpResponse(return_str)