Notes
![]() ![]() Notes - notes.io |
def login_page(request):
"""
This view authenticate the user required information to log in the accounts.
"""
message = ''
if request.method == 'POST':
form = LoginForm(data=request.POST)
if form.is_valid():
user = authenticate(
username=form.cleaned_data['username'],
password=form.cleaned_data['password'], )
if user is not None:
login(request, user)
messages.success(request, 'You are login successfully.')
# # return HttpResponseRedirect('/jitsi/record')
return HttpResponseRedirect('/jitsi/home')
'''
else:
username = form.cleaned_data['username']
password = form.cleaned_data['password']
x = AnonymousUser.objects.filter(name=username, password=password)
for i in x:
meet = get_object_or_404(Meeting, room_id=i.meeting.room_id)
attendees = meet.attendees.all()
return render(request,
'jitsi/meeting.html',
{"meeting": meet,
"attendees": attendees,
})
if AnonymousUser.objects.filter(name=username, password=password).exists():
x = AnonymousUser.objects.filter(name=username, password=password)
for i in x:
# jitsi_url = f"https://meet.jit.si/{room_name}?token={token}"
print(i.meeting.room_id)
print('Yesssssssssssssssssssssssssss')
print('********', username, password)
token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxRTZCRkYxMDEiLCJzdWIiOiJwb2RjYXN0b3BlcmF0aW9uLmNvbSIsIm5hbWUiOiJHYW5kaGkiLCJhdWQiOiIxRTZCRkYxMDEifQ.h-A58FeRzeZcp_4OaQj34tfI8-E-Pqbes5t0LiM99fI'
return HttpResponseRedirect(f'/jitsi/meeting/{i.meeting.room_id}?jwt={token}')
'''
else:
form = LoginForm()
return render(request, 'accounts/login.html', context={'form': form, 'message': message})
def signup_page(request):
if request.method == 'POST':
form = SignUpForm(data=request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get('username')
raw_password = form.cleaned_data.get('password1')
user = authenticate(username=username, password=raw_password)
login(request, user)
messages.success(request, 'You account create successfully.')
return redirect('/jitsi/record')
else:
form = SignUpForm()
return render(request, 'accounts/signup.html', {'form': form})
def create_meeting(request):
all_user = User.objects.all()
create_meeting_form = MeetingForm()
if request.method == 'POST':
create_meeting_form = MeetingForm(data=request.POST)
if create_meeting_form.is_valid():
create_meeting_form.save()
obj_form = Meeting.objects.latest('id')
for key, value in request.POST.items():
global value_
if re.match(r"^user_", key):
if value == '-----':
value_ = None
break
attendee_id = key
value_ = value
obj_form.attendees.add(request.POST[attendee_id])
if re.match(r"^is_moderator_", key):
if value == 'on':
Attendee.objects.filter(user=value_, meeting_id=obj_form.id).update(is_moderator=True)
response_data = {'success': True, 'redirect_url': '/jitsi/record'}
return JsonResponse(response_data)
else:
create_meeting_form1 = MeetingForm(data=request.POST)
return render(request, 'jitsi/newMeeting.html',
context={'createmeeting': create_meeting_form1, 'users': all_user})
# return render(request, 'jitsi/newMeeting.html', context={'createmeeting': create_meeting_form, 'users': all_user})
return render(request, 'jitsi/newMeeting.html', context={'createmeeting': create_meeting_form, 'users': all_user})
def updateMeeting(request, id1):
all_user = User.objects.all()
update_Meeting = Meeting.objects.get(id=id1)
update_Meeting.start_time = update_Meeting.start_time.strftime('%Y-%m-%dT%H:%M')
update_form = MeetingForm(request.POST, instance=update_Meeting)
attendee_data = Attendee.objects.filter(meeting=update_Meeting)
di = {'updatemeeting': update_form, 'update_meet': update_Meeting, 'users': all_user,
'us1': update_Meeting.is_anonymous, 'attendee_record': attendee_data, "user_id": id1}
if request.method == "POST":
update_Meeting = Meeting.objects.get(id=id1)
if update_Meeting.start_time is not None:
update_Meeting.start_time = update_Meeting.start_time.strftime('%Y-%m-%dT%H:%M')
update_form = MeetingForm(request.POST, request.FILES, instance=update_Meeting)
if update_form.is_valid():
obj_form = Meeting.objects.get(id=id1)
for key, value in request.POST.items():
global value_
if re.match(r"^user_", key):
if value == '-----':
value_ = None
break
attendee_id = key
value_ = value
obj_form.attendees.add(request.POST[attendee_id])
if re.match(r"^is_moderator_", key):
if value == 'on':
Attendee.objects.filter(user=value_, meeting_id=id1).update(is_moderator=True)
update_form.save()
response_data = {'success': True, 'redirect_url': '/jitsi/record'}
return JsonResponse(response_data)
return render(request, 'jitsi/updateMeeting.html', context=di)
def remove_attendee(request, id1):
rm_attendee = Attendee.objects.get(id=id1)
rm_attendee.delete()
meeting_id = rm_attendee.meeting.id
return redirect(f"/jitsi/updateMeeting/{meeting_id}")
def show_meeting(request):
meeting_rec = Meeting.objects.all()
return render(request, 'jitsi/meetingDetails.html', context={'data': meeting_rec})
def home(request):
"""
This is the home page to list the upcoming meetings on the UI.
"""
if str(request.user) == 'AnonymousUser':
upcoming = Attendee.objects.filter(
meeting__start_time__gt=timezone.now()).order_by('meeting__start_time')
return render(request, 'jitsi/dashboard.html', {"upcoming": upcoming})
else:
upcoming = Attendee.objects.filter(user=request.user,
meeting__start_time__gt=timezone.now()).order_by('meeting__start_time')
return render(request, 'jitsi/hosting-dashboard.html', {"upcoming": upcoming})
@login_required
def meeting_data(request, room):
"""
This view provide the meeting details regarding the meeting room name, subject and domain name.
"""
attendee = Attendee.objects.get(meeting__room_id=room, user=request.user)
# attendee = Attendee.objects.get(meeting__room_id=room,) #user_infor= meeting table)
return JsonResponse({
"jwt": attendee.jwt(),
"roomName": attendee.meeting.room_id,
"domain": settings.JITSI_DOMAIN,
"subject": attendee.meeting.subject,
"moderator": attendee.is_moderator,
"user": str(request.user),
})
# @login_required
def meeting(request, room):
meeting_url = request.build_absolute_uri()
"""
This view return the meeting object with some parameters on the UI page.
"""
# if not Attendee.objects.filter(user=request.user,
# meeting__room_id=room).exists():
# raise PermissionDenied
meet = get_object_or_404(Meeting, room_id=room)
attendees = meet.attendees.all()
guest_link = None
if meet.is_anonymous:
# print(meet.room_id)
guest_link = f"https://{settings.JITSI_DOMAIN}/{meet.room_id}?jwt={meet.jwt()}"
guest_link1 = f"http://127.0.0.1:8000/jitsi/meeting/{meet.room_id}?jwt={meet.jwt()}"
# # guest_link = f"http://127.0.0.1:8000/jitsi/meeting/{meet.room_id}"
return render(request,
'jitsi/meeting.html',
{"meeting": meet,
"attendees": attendees,
"guest_link": guest_link,
'meeting_url': meeting_url})
#
#
def Ann_meeting(request, room):
meeting_url = request.build_absolute_uri()
"""
This view return the meeting object with some parameters on the UI page.
"""
if not Attendee.objects.filter(user=request.user, meeting__room_id=room).exists():
raise PermissionDenied
meet = get_object_or_404(Meeting, room_id=room)
attendees = meet.attendees.all()
guest_link = None
if meet.is_anonymous:
guest_link = f"https://{settings.JITSI_DOMAIN}/{meet.room_id}?jwt={meet.jwt()}"
print('***', guest_link)
return render(request,
'jitsi/meeting.html',
{"meeting": meet,
"attendees": attendees,
"guest_link": guest_link,
'meeting_url': meeting_url})
def all_anonymousUser(request, id1):
anonymous_user = AnonymousUser.objects.filter(meeting__id=id1)
# all_user = AnonymousUser.objects.all()
# print('+++++', request.GET.get('url'))
for i in anonymous_user:
meet = get_object_or_404(Meeting, room_id=i.meeting.room_id)
if meet.is_anonymous:
guest_link = f"https://{settings.JITSI_DOMAIN}/{meet.room_id}?jwt={meet.jwt()}"
di = {'user_data': anonymous_user}
if request.method == 'POST':
selected_fruits = request.POST.getlist('email')
return HttpResponseRedirect('/jitsi/home')
return render(request, 'jitsi/anonymousUser.html', context=di)
@login_required
def custom_logout(request):
logout(request)
messages.success(request, "Logged out successfully!")
return redirect("/jitsi/")
@login_required
def remove_meeting(request, id1):
rm_meeting = Meeting.objects.get(id=id1)
messages.success(request, f'{rm_meeting.room_id} delete successfully.')
rm_meeting.delete()
return redirect("/jitsi/record")
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team