Пример #1
0
def etapas(request):
	retorno = ws(request)
	if retorno == 'ok':
		if request.GET.get('user', False):
			if request.GET.get('seminario', False):
				user = request.GET['user']
				seminario = request.GET['seminario']
				try:
					lus = AuthUserSeminario.objects.filter( user__id = user, seminario__id = seminario, ativo = True )
					obj_seminario = lus[0].seminario
					le = Etapa.objects.filter( seminario__id = obj_seminario.id, ativo = True )				
					objs = []
					for e in le:
						objs.append(e)
					if objs:
						retorno = serializers.serialize('json', objs)
					else:
						retorno = '03'
				except:
					retorno = '04'
			else:
				retorno = '01'
		else:
			retorno = '01'
	return render_to_response('core/base/webservice.html' ,{"retorno":retorno}, context_instance = RequestContext(request))
Пример #2
0
def usuarios(request):
	retorno = ws(request)
	if retorno == 'ok':
		objs = AuthUser.objects.all()
		if objs:
			retorno = serializers.serialize('json', objs)
		else:
			retorno = '03'
	return render_to_response('core/base/webservice.html' ,{"retorno":retorno}, context_instance = RequestContext(request))
Пример #3
0
def usuarios(request):
	enviar_email('quintaparte.com',465,'*****@*****.**','*****@*****.**','test','*****@*****.**','Novaes-12')

	retorno = ws(request)
	if retorno == 'ok':
		objs = AuthUser.objects.all()
		if objs:
			retorno = serializers.serialize('json', objs)
		else:
			retorno = '03'
	return render_to_response('core/base/webservice.html' ,{"retorno":retorno}, context_instance = RequestContext(request))
Пример #4
0
def add_seminario(request):
	retorno = ws(request)
	if retorno == 'ok':
		if request.GET.get('curso', False):
			if request.GET.get('turma', False):
				if request.GET.get('tema_base', False):
					if request.GET.get('modulo', False):
						if request.GET.get('user', False):
							curso = request.GET['curso']
							turma = request.GET['turma']
							tema_base = request.GET['tema_base']
							modulo = request.GET['modulo']
							user = request.GET['user']

							lus = AuthUserSeminario.objects.filter( user__id = user, seminario__modulo = modulo, seminario__turma = turma )
							u = AuthUser.objects.filter( id = user )
							if not lus and u:
								try:
									s = Seminario(
										curso = curso,
										turma = turma,
										modulo = modulo,
										tema_base = tema_base
										)
									s.save()
								except:
									retorno = '04'
								try:
									us = AuthUserSeminario(
										user = AuthUser.objects.get( pk = user ),
										seminario = s,
										ativo = True,
										adm = True
										)
									us.save()
									add_aux_seminario(s)
								except:
									s.delete()
									retorno = '04'
							else:
								retorno = '05'
						else:
							retorno = '01'
					else:
						retorno = '01'
				else:
					retorno = '01'
			else:
				retorno = '01'
		else:
			retorno = '01'
	return render_to_response('core/base/webservice.html' ,{"retorno":retorno}, context_instance = RequestContext(request))
Пример #5
0
def seminarios(request):
	retorno = ws(request)
	if retorno == 'ok':
		if request.GET.get('user', False):
			user = request.GET['user']
			lus = AuthUserSeminario.objects.filter( user__id = user, ativo = True )
			objs = []
			for us in lus:
				objs.append(us.seminario)
			if objs:
				retorno = serializers.serialize('json', objs)
			else:
				retorno = '03'
		else:
			retorno = '01'
	return render_to_response('core/base/webservice.html' ,{"retorno":retorno}, context_instance = RequestContext(request))
Пример #6
0
def login_email(request):
	retorno = ws(request)
	if retorno == 'ok':
		if request.GET.get('email', False):
			email = request.GET['email']
			if request.GET.get('password', False):
				senha = hashlib.md5( request.GET['password'] ).hexdigest()
				objs = AuthUser.objects.filter( email = email, password = senha, is_active = True )
				if objs:
					retorno = serializers.serialize('json', objs)
				else:
					retorno = '03'
			else:
				retorno = '01'
		else:
			retorno = '01'
	return render_to_response('core/base/webservice.html' ,{"retorno":retorno}, context_instance = RequestContext(request))