def view_note(request, note_id): # Validate note current_note = validate_ownership_note(request.user, note_id) # Render current_note.rendered_content = render_markdown(current_note.content) context = trash_context(request.user) context['current_note'] = current_note return render(request, 'view_trash_note.html', context)
def view_shared_note(request, note_id, code): # Validate note note, sharable_link = validate_ownership_shared_note(request, note_id, code) # Render note.rendered_content = render_markdown(note.content) context = regular_context(request.user) context['current_note'] = note context['code'] = sharable_link.code context['permissions'] = sharable_link.permissions return render(request, 'view_shared_note.html', context)
def view_shared_note(request, note_id, code): # Validate note note, sharable_link = validate_ownership_shared_note( request, note_id, code) # Render note.rendered_content = render_markdown(note.content) context = regular_context(request.user) context['current_note'] = note context['code'] = sharable_link.code context['permissions'] = sharable_link.permissions return render(request, 'view_shared_note.html', context)
def share_note(request, note_id): # Validate note current_note = validate_ownership_note(request.user, note_id) # Render sharable_links = current_note.sharablelink_set.all() for link in sharable_links: args = {'note_id': current_note.id, 'code': link.code} link.full_url = request.build_absolute_uri(reverse('share:view-note', kwargs=args)) current_note.rendered_content = render_markdown(current_note.content) context = regular_context(request.user) context['current_note'] = current_note context['sharable_links'] = sharable_links return render(request, 'share_note.html', context)
def share_note(request, note_id): # Validate note current_note = validate_ownership_note(request.user, note_id) # Render sharable_links = current_note.sharablelink_set.all() for link in sharable_links: args = {'note_id': current_note.id, 'code': link.code} link.full_url = request.build_absolute_uri( reverse('share:view-note', kwargs=args)) current_note.rendered_content = render_markdown(current_note.content) context = regular_context(request.user) context['current_note'] = current_note context['sharable_links'] = sharable_links return render(request, 'share_note.html', context)