Skip to content

Instantly share code, notes, and snippets.

@Chukslord1
Created July 31, 2021 13:37
Show Gist options
  • Save Chukslord1/2e933ddad5c23582076a54cfecf3a650 to your computer and use it in GitHub Desktop.
Save Chukslord1/2e933ddad5c23582076a54cfecf3a650 to your computer and use it in GitHub Desktop.
Agora Video Application- The Shedule View
def schedule(request):
context={}
try:
if request.method =="POST":
channel = request.POST.get("channel_name")
meeting_title = request.POST.get("meeting_title")
meeting_subject = request.POST.get("meeting_subject")
start_time = request.POST.get("start_time")
end_time = request.POST.get("end_time")
date = request.POST.get("date")
if Meeting.objects.filter(channel=channel):
if datetime.now().time()> Meeting.objects.get(channel=channel).end_time:
meeting_old=Meeting.objects.get(channel=channel)
meeting_old.delete()
meeting = Meeting.objects.create(channel=channel,meeting_title=meeting_title,
meeting_subject=meeting_subject,start_time=start_time, end_time=end_time,date=date)
meeting.save()
filename=meeting_title.replace(" ","")+".txt"
with open(filename, 'x') as f:
f.write('meeting title: '+meeting_title+"\n channel: "+channel+"\n meeting_subject: "+meeting_subject+"\n time: "+ time+"\n date: "+date)
context={"message":"File With meeting details added to directory"}
else:
context={"message":"Channel with the same name already exists"}
else:
meeting = Meeting.objects.create(channel=channel,meeting_title=meeting_title,
meeting_subject=meeting_subject,start_time=start_time, end_time=end_time,date=date)
meeting.save()
filename=meeting_title.replace(" ","")+".txt"
with open(filename, 'x') as f:
f.write('meeting title: '+meeting_title+"\n channel: "+channel+"\n meeting_subject: "+meeting_subject+"\n start time: "+ start_time+"\n end time: "+ end_time+"\n date: "+date)
context={"message":"File With meeting details added to directory"}
except:
context={"message":"An error occurred"}
return render(request,"app1/schedule.html",context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment