def allnotice(request): context = {} if auth_fun.admin_per(request.user): context['notices'] = Notices.objects.all() return render(request, 'admin/allnotice.html', context) else: return redirect('login')
def allclubs(request): if auth_fun.admin_per(request.user): context = {} context['clubs'] = Clubs.objects.all() return render(request, 'admin/allclubs.html', context) else: return redirect('login')
def allnews(request): context = {} if auth_fun.admin_per(request.user): context['news_all'] = News.objects.all() return render(request, 'admin/allnews.html', context) else: return redirect('login')
def clubsingle(request, clubname): context = {} if auth_fun.admin_per(request.user): club = Clubs.objects.get(clubname=clubname) club_ec = Club_Ec.objects.filter(club=club).values( 'id', 'ec_id__username', 'ec_id__email', 'ec_id__phone_number', 'date_joined', 'club__clubname', 'designation') context['details'] = club_ec context['club'] = club if request.POST: print("hello") return render(request, 'admin/clubsingle.html', context) else: return redirect('login')
def deletenews(request, id): context = {} if auth_fun.admin_per(request.user): try: news = News.objects.get(pk=id) except News.DoesNotExist: news = None if news: news.delete() return redirect('allnews') else: return HttpResponse("Does Not Exit") else: return redirect('login')
def registerclub(request): context = {} if auth_fun.admin_per(request.user): if request.POST: form = registerClub(request.POST, request.FILES) if form.is_valid(): form.save() return redirect('adminHome') else: context['form'] = form else: form = registerClub() context['form'] = form return render(request, 'admin/createclub.html', context) else: return redirect('login')
def uploadcalendar(request): context = {} if auth_fun.admin_per(request.user): if request.POST: form = upload_calendar_form(request.POST, request.FILES) if form.is_valid(): form.save() return redirect('adminHome') else: context['form'] = form else: form = upload_calendar_form() context['form'] = form return render(request, 'admin/addcalendar.html', context) else: return redirect('login')
def addnews(request): context = {} context['success_msg'] = "" if auth_fun.admin_per(request.user): if request.POST: form = addnewsform(request.POST) if form.is_valid(): form.save() form = addnewsform() context['form'] = form context[ 'success_msg'] = "News is Added. This will be show for user " else: context['form'] = form else: form = addnewsform() context['form'] = form return render(request, 'admin/addnews.html', context) else: return redirect('login')
def mainAdmin(request): if auth_fun.admin_per(request.user): return render(request, 'admin/admin.html') else: return redirect('login')