def home(request): """View for home page.""" if UserProfileS.objects.filter(user=request.user.id): return index(request) elif UserProfileF.objects.filter(user=request.user.id): userprofile = UserProfileF.objects.filter(user=request.user.id) if userprofile[0].department == 'ADMINISTRATION': return indexa(request) else: return indexf(request) else: return render(request, 'vtr/home.html')
def add_queryH(request): """Hostel query add view.""" if request.method == 'POST': query_form = QueryFormH(request.POST, request.FILES) if query_form.is_valid(): query = query_form.save(commit=False) query.user = request.user query.save() query_form.save_m2m() if UserProfileF.objects.filter(user=request.user.id): return indexf(request) else: return redirect(hostelQ) else: print query_form.errors else: query_form = QueryFormH() return render(request, 'hostel/add_query.html', {'query_form': query_form},)