fixed implementation of UGC content uploader

This commit is contained in:
2026-08-03 18:57:39 -05:00
parent 39e31d3980
commit 473b3c811b
40 changed files with 4137 additions and 87 deletions
+15 -1
View File
@@ -8,8 +8,10 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm, UserCreationForm
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from common.markdown import render_markdown
from library.models import FileIndex
from .forms import AvatarForm, BioForm, EmailForm, UsernameForm
@@ -200,4 +202,16 @@ def user_profile(request, username):
'profile_user': user,
'is_owner': is_owner,
'bio_form': bio_form,
})
'projects': user.projects.select_related('owner', 'thumbnail').prefetch_related(
'tag_links__tag__category', 'versions',
).all(),
})
@login_required
def bio_preview(request):
"""Return the markdown-rendered HTML for a bio draft (editor live preview)."""
if request.method != 'POST':
return JsonResponse({'detail': 'Method not allowed'}, status=405)
text = request.POST.get('bio', '')
return JsonResponse({'html': render_markdown(text)})