User Controls
When you edit threads why can't we edit the title aswell?
-
2023-08-30 at 9:52 AM UTCIM A DUMBASS AND DONT HAVE TIME TO PROOFREAD
-
2023-08-30 at 1:16 PM UTCThis is one of life's mysteries.
-
2023-08-30 at 1:18 PM UTCSubmit a pull
-
2023-08-30 at 10:39 PM UTCYou probably should be able to, it just complicates the post editing logic to have to treat OPs as a special case (and I do think that’s how you’d have to do it, separate UI for editing threads and posts seems dumb). As a wise man once said, submit a pull
-
2023-08-30 at 11:27 PM UTC
from django.http import JsonResponse
from django.shortcuts import render, get_object_or_404
from .models import Thread
from googletrans import Translator
def serious_thing(request, thread_id):
if request.method == 'POST' and request.is_ajax():
thread = get_object_or_404(Thread, pk=thread_id)
translator = Translator()
spanish_title = translator.translate(thread.title, src='en', dest='es').text
english_title = translator.translate(spanish_title, src='es', dest='en').text
thread.title = english_title
thread.save()
response_data = {
'success': True,
'message': 'i hatchu',
'english_title': english_title,
}
return JsonResponse(response_data)
response_data = {
'success': False,
'message': 'AJAX request failed.',
}
return JsonResponse(response_data)
def edit_thread_title(request, thread_id):
thread = get_object_or_404(Thread, pk=thread_id)
return render(request, 'edit_thread_title.html', {'thread': thread}) -
2023-08-30 at 11:29 PM UTCsummit a pool
-
2023-08-30 at 11:40 PM UTC
Originally posted by Meikai summit a pool
k
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.
(###############################################################)
) .-. (
( //()\ N I G G E R S )
) OOOOOOOOOOOOOOOOO P O O L C L O S E D (
( \()// )
) '-' (
(###############################################################)
) (()) ___ - ' ^ ((()))^ - ~ ' : (
( (()) /` _\ ` ~_ - ((()))~ ' ^ ` )
)(()) | / 0|--. ^ ^ ((())) ~ ^ - ~ (
(),' - / \_|0`/ /.`'._/) ` ,' '- _ ^ _ . )
)) ^_| /-_~ ^- ~_` - -~ _ ((())) ` - ^(
() -| | - ~ - ~ - ((())) ^ ~ ~ ` )
) ' \ \, ~ - ~ ((())) - _ ` ^ ^ (
( ` \_| _ _ - ,' ` ~` - ' - )
)' ^ - ((())) _ ^ _ ~ ' ~ ` (
( ~ ` ((.--'''''--._ - ` _ ^ )
) ' _ ^ ~ ' .' '. ` ^ ` . _ (
( ~ ' ` / \ : _ -^ )
) ~ ` (/ \ ~ . ` (
( ` - ^ (; ; . ~ ` ' )
) - ^ ((| __..-----..__ | ' - ~ ' (
( ` _ ~ ,'|_.:' ':._.:' ':._|- ' _ ^ )
)' ((())|-`:.___.:'-':.___.:'-| ~ _ `- (
( ^ ~ ((()))/` | | `\ ^ _ ` )
) _ ^ ((())) |( | | )| ^ ' (
( ~ ' ,' \_ (_ _) _/ ` - (()
)` ~ -((())) ^ : _ _ :^ ^ ~ (((
( ' ((())) - ~ \ .'-.-'. / ^ ` - ` ((())
) `((())) ' ^ \ `.-.-.' / ~ ~ _ ^ ,'(
( ^ ,' ~ ` - '._ ``` _.' ^. ' _ - ((())))
) - ((())) .-'''''-.___) `-----' (___.-'''''-. ^ ~ ((()))(
( ((())) .` | | | | `. ((())) )
) ` ((())).' | \ : : / | `. ,' (
( - ,' / ; '-._ _.-' ; \(())) ^_ )
)((()))_;_ ___ ___ __/ ___ ___```_ ___ __\____ ___ ___;))_ __ (
( / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ )
) jgs__ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / (
( / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / )
'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-'^'-' -
2023-08-31 at 1:03 AM UTCPull a submit it's what the admin does best.
-
2023-08-31 at 3:24 AM UTC
Originally posted by WALUIGI TACO STAND IS A REAL GAME
from django.http import JsonResponse
from django.shortcuts import render, get_object_or_404
from .models import Thread
from googletrans import Translator
def serious_thing(request, thread_id):
if request.method == 'POST' and request.is_ajax():
thread = get_object_or_404(Thread, pk=thread_id)
translator = Translator()
spanish_title = translator.translate(thread.title, src='en', dest='es').text
english_title = translator.translate(spanish_title, src='es', dest='en').text
thread.title = english_title
thread.save()
response_data = {
'success': True,
'message': 'i hatchu',
'english_title': english_title,
}
return JsonResponse(response_data)
response_data = {
'success': False,
'message': 'AJAX request failed.',
}
return JsonResponse(response_data)
def edit_thread_title(request, thread_id):
thread = get_object_or_404(Thread, pk=thread_id)
return render(request, 'edit_thread_title.html', {'thread': thread})
Hah, that might be a fun gag. Like a subforum where all the post bodies are translated out of English and back and you never really know what the poster was originally trying to say.