Created
July 31, 2021 13:37
-
-
Save Chukslord1/2e933ddad5c23582076a54cfecf3a650 to your computer and use it in GitHub Desktop.
Agora Video Application- The Shedule View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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