def get_phase(request): id_phase = request.POST.get("id_phase") phase = Phase.objects.get(id=id_phase) context = { 'phase': phase, 'activities': phase.activities } return return_generic(request, "phase.html", context)
def list_hackathon(request): id = request.POST.get('team_id') team = Team.objects.get(id=id) user = request.user member = Member.objects.filter(id_user=user, id_team=team) if member: hackathons = Hackathon.objects.filter(team_manager=team) context = {'hackathons': hackathons} return return_generic(request, 'competicoes/index.html', context) return return_team(request, None)
def get_hackathon(request, hackathon,team): hackathon = Hackathon.objects.get(slug=hackathon) team = Team.objects.get(slug=team) list_phases = [] listi = [] for phase in hackathon.phases.all(): i = 0 for act in phase.activities.all(): if act.id_team == team: i=1 if i == 0: listi.append(phase) list_phases.append({phase.activities.all()}) context = { 'hackathon': hackathon, 'teams_of_hackathon': hackathon.teams.all(), 'phases_of_hackathon': listi, 'phases_of_hackathon_2': hackathon.phases.all(), 'activities_of_hackathon': list_phases, 'team': team} return return_generic(request, 'competicoes/index.html', context)
def update_user(request): user = request.user if request.user.is_authenticated: username = request.POST.get('username') email = request.POST.get('email') first_name = request.POST.get('first_name') last_name = request.POST.get('last_name') if username != '': test_username = User.objects.filter(username=username).exists() if test_username: return return_generic( request, 'settings.html', {'error': 'Este username já existe, tente novamente!'}) user.username = username if email != '': user.email = email if first_name != '': user.first_name = first_name if last_name != '': user.last_name = last_name user.save() return return_team(request, None) return redirect("../login/")
def settings(request): return return_generic(request, 'settings.html', None)
def dashboard_hackathon(request): return return_generic(request, 'competicoes/index.html', None)