fixed minor blog issues

This commit is contained in:
Alexander Karpov 2023-01-14 01:40:51 +03:00
parent 11d176adcc
commit f28b57636d
21 changed files with 10 additions and 328 deletions

View File

@ -15,8 +15,10 @@ def post_on_save(sender, instance: Post, **kwargs):
instance.slug = slug
else:
previous = Post.objects.get(id=instance.id)
if previous.image != instance.image and kwargs["update_fields"] != frozenset(
{"image_cropped"}
if (
previous.image != instance.image
and kwargs["update_fields"] != frozenset({"image_cropped"})
and instance
):
if instance.image:
crop_model_image.apply_async(
@ -29,7 +31,6 @@ def post_on_save(sender, instance: Post, **kwargs):
)
else:
instance.image_cropped = None
instance.save()
@receiver(pre_save, sender=Tag)

View File

@ -1,5 +1,5 @@
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import ValidationError
from django.core.exceptions import PermissionDenied, ValidationError
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
@ -57,7 +57,10 @@ class PostUpdateView(LoginRequiredMixin, UpdateView):
form_class = PostForm
def get_object(self):
return get_object_or_404(Post, slug=self.kwargs["slug"])
post = get_object_or_404(Post, slug=self.kwargs["slug"])
if post.creator != self.request.user:
raise PermissionDenied
return post
template_name = "blog/form.html"

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'bg', {
dateFormat: 'LLL',
autoSaveMessage: 'Запазено автоматично',
loadSavedContent: 'Намерена е автоматично запазена версия на това съдържание от "{0}". Искате ли да сравните версиите на съдържанието и да изберете коя да се зареди? "Отказ" ще премахне по-рано автоматично запазеното съдържание.',
title: 'Сравнете автоматично запазеното съдържание със зареденото от сайта',
loadedContent: 'Заредено съдържание',
localStorageFull: 'LocalStorage на браузърът е пълен, изчистете хранилището си или увеличете размера на базата данни',
autoSavedContent: 'Автоматично запазено съдържание от: \'',
ok: 'Да, заредете автоматично запазеното съдържание',
no: 'Не',
diffType: 'Изберете вид на изгледа:',
sideBySide: 'Изглед един до друг',
inline: 'Поредов изглед'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'ca', {
dateFormat: 'LLL',
autoSaveMessage: 'Auto desat',
loadSavedContent: 'S\'ha trobat una versió auto-desada d\'aquest contingut de "{0}". Voleu comparar les versions del contingut i escollir quina carregar?',
title: 'Compareu el contingut auto-desat amb el contingut carregat del lloc web',
loadedContent: 'Contingut carregat',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: 'Contingut auto-desat de: \'',
ok: 'Sí, carrega el contingut auto-desat',
no: 'No',
diffType: 'Esculliu el tipus de visualització:',
sideBySide: 'Visualització un al costat de l\'altre',
inline: 'Visualització en línia'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'cs', {
dateFormat: 'LLL',
autoSaveMessage: 'Automaticky uloženo',
loadSavedContent: 'Byla nalezena automaticky uložená verze obsahu ze dne "{0}". Chcete porovnat obsah a zvolit si s kterým obsahem chete pracovat?',
title: 'Porovnejte automaticky uložený obsah s obsahem nahraným z webové stránky',
loadedContent: 'Nahraný obsah',
localStorageFull: 'Místní úložiště prohlížeče je plné, vymažte úložiště nebo zvětšete velikost databáze',
autoSavedContent: 'Automaticky uložený obsah z: \'',
ok: 'Ano, zvolit automaticky uložený obsah',
no: 'Ne',
diffType: 'Zvolte si typ náhledu:',
sideBySide: 'Pohled HTML vedle HTML',
inline: 'Pohled Obsah/Obsah'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'de', {
dateFormat: 'LLL',
autoSaveMessage: 'Automatisch gespeichert',
loadSavedContent: 'Es wurde ein autom. Gespeicherter Inhalt gefunden (vom "{0}"). Wollen Sie den Inhalt vergleichen, um dann entscheiden zu können ob der Inhalt geladen werden soll?',
title: 'Temp. Gespeichert Inhalt vergleichen',
loadedContent: 'Geladener Inhalt',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: 'Autom. Gespeicherten Inhalt (vom: \'',
ok: 'Ja, Lade Autom. Gespeicherten Inhalt',
no: 'Nein',
diffType: 'Diff Anzeigetyp:',
sideBySide: 'Nebeneinander',
inline: 'Inline'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'es', {
dateFormat: 'LLL',
autoSaveMessage: 'Auto guardado',
loadSavedContent: 'Se ha encontrado una versión auto-guardada de este contenido de "{0}". Queréis comparar el contenido de las versiones y elegir cual cargar?',
title: 'Compara el contenido auto-guardado con el cargado del sitio web',
loadedContent: 'Contenido cargado',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: 'Contenido auto-guardado de: \'',
ok: 'Si, carga el contenido auto-guardado',
no: 'No',
diffType: 'Escoge el tipo de visualización:',
sideBySide: 'Visualización uno al lado del otro',
inline: 'Visualización en línea'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'eu', {
dateFormat: 'LLL',
autoSaveMessage: 'Automatikoki gorde da',
loadSavedContent: 'Eduki honen automatikoki gordetako "{0}"(e)ko bertsio bat aurkitu da. Edukien bertsioak konparatu eta zein kargatu aukeratu nahi duzu? Utzi botoian klik eginez gero aurrez automatikoki gordetako edukia ezabatuko da.',
title: 'Konparatu automatikoki gordetako edukia webgunetik kargatutakoarekin',
loadedContent: 'Kargatutako edukia',
localStorageFull: 'Nabigatzailearen biltegiratze lokala beteta dago, garbitu biltegiratzea edo handitu datu-basearen tamaina',
autoSavedContent: 'Hemendik automatikoki gordetako edukia: \'',
ok: 'Bai, kargatu automatikoki gordetako edukia',
no: 'Ez',
diffType: 'Aukeratu ikuspegi mota:',
sideBySide: 'Alboz-alboko ikuspegia',
inline: 'Lineako ikuspegia'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'fr', {
dateFormat: 'LLL',
autoSaveMessage: 'Sauvegarde automatique',
loadSavedContent: 'Une précédente version a été sauvegardée le "{0}". Voulez-vous l\'afficher et la comparer avec le document en cours ?',
title: 'Comparaison du document en cours et du document sauvegardé',
loadedContent: 'Document en cours',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: 'Document sauvegardé le : \'',
ok: 'Oui, charger le document sauvegardé',
no: 'Non, continuer avec le document en cours',
diffType: 'Afficher les deux documents : ',
sideBySide: 'Côte à côte',
inline: 'L\'un sous l\'autre'
});

View File

@ -1,17 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'it', {
dateFormat: 'LLL',
autoSaveMessage: 'Salvataggio automatico',
loadSavedContent: 'C\'è una versione salvata automaticamente di questi contenuti da "{0}": desideri confrontare le due versioni per decidere quale utilizzare?',
title: 'Confronta i contenuti salvati automaticamente con quelli caricati dal sito web',
loadedContent: 'Contenuti caricati',
autoSavedContent: 'Contenuti salvati automaticamente da: \'',
ok: 'Si, carica i contenuti salvati automaticamente',
no: 'No',
diffType: 'Scegli il tipo di visualizzazione:',
sideBySide: 'Vista affiancata',
inline: 'Vista in linea'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'ja', {
dateFormat: 'LLL',
autoSaveMessage: '自動保存されました',
loadSavedContent: '投稿途中だった内容があります({0})。現在保存されている投稿と比較しますか?',
title: 'Compare auto-saved content with that loaded from the website',
loadedContent: '現在保存されている投稿',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: '投稿途中だった内容: \'',
ok: '投稿途中だった内容(緑)を使う',
no: 'いいえ',
diffType: '比較モード',
sideBySide: '横に並べる',
inline: '行ごとに比較'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'nl', {
dateFormat: 'LLL',
autoSaveMessage: 'Automatisch opgeslagen',
loadSavedContent: 'Een automatisch opgeslagen versie van deze inhoud van "{0}" is gevonden. Wilt u de inhoud van deze versies vergelijken en kiezen welke te laden?',
title: 'Vergelijk automatisch opgeslagen inhoud met die geladen van de website',
loadedContent: 'Geladen inhoud',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: 'Automatisch opgeslagen inhoud van: \'',
ok: 'Ja, laad automatisch opgeslagen inhoud',
no: 'Nee',
diffType: 'Selecteer weergave:',
sideBySide: 'Zij aan zij weergave',
inline: 'In lijn weergave'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'pl', {
dateFormat: 'LLL',
autoSaveMessage: 'Auto Saved',
loadSavedContent: 'Istnieje automatycznie zapisana wersja zawartości (z "{0}"). Otworzyć okno porównawcze, w którym można zadecydować o wczytaniu automatycznie zapisanej zawartości?',
title: 'Porównanie tymczasowo zapisanej zawartości z zawartością wczytaną w witrynie',
loadedContent: 'Zawartość wczytania',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: 'Zawartość zapisana automatycznie (z: \'',
ok: 'Tak, wczytaj automatycznie zapisaną treść',
no: 'Nie',
diffType: 'Widok porównawczy:',
sideBySide: 'Obok siebie',
inline: 'Osadzony'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'pt-br', {
dateFormat: 'LLL',
autoSaveMessage: 'Salvo automaticamente',
loadSavedContent: 'Uma versão salva automaticamente deste conteúdo de "{0}" foi encontrada. Gostaria de comparar o conteúdo dessas versões e escolher qual delas será carregada?',
title: 'Compare o conteúdo salvo automaticamente com o carregado a partir do site',
loadedContent: 'Carregar conteúdo',
localStorageFull: 'O armazenamento do navegador está cheio, limpe o armazenamento ou aumente o tamanho do banco de dados',
autoSavedContent: 'Conteúdo gravado automaticamente em: \'',
ok: 'Sim, carregue o conteúdo salvo',
no: 'Não',
diffType: 'Escolher tipo de visualização:',
sideBySide: 'Visão lado-a-lado',
inline: 'Visão em linha'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'sk', {
dateFormat: 'LLL',
autoSaveMessage: 'Automaticky uložené',
loadSavedContent: 'Bola nájdená automaticky uložená verzia z "{0}". Chcete porovnať obsah a vybrať verziu, ktorú chcete použiť?',
title: 'Porovnanie automaticky uloženého obsahu s obsahom nahraným z webu',
loadedContent: 'Nahraný obsah z webu',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: 'Automaticky uložený obsah z: \'',
ok: 'Použiť automaticky uložený obsah',
no: 'Použiť obsah z webu',
diffType: 'Zvoliť typ náhľadu:',
sideBySide: 'Vedľa seba',
inline: 'Pod sebou'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'sv', {
dateFormat: 'LLL',
autoSaveMessage: 'Autosparat',
loadSavedContent: 'En autosparad version av det här innehållet (från "{0}") hittades. Vill du öppna en dialogruta för att jämföra, där du även kan välja att läsa in det autosparade innehållet?',
title: 'Jämför temporärt sparat innehåll med det inladdade innehållet från sidan',
loadedContent: 'Inladdat innehåll',
localStorageFull: 'Webbläsarens localStorage är full, töm din lagring eller öka databasstorleken',
autoSavedContent: 'Autosparat innehåll från: \'',
ok: 'Ja, läs in autosparat innehåll',
no: 'Nej',
diffType: 'Visa skillnader:',
sideBySide: 'Sida vid sida',
inline: 'Ihop'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'tr', {
dateFormat: 'LLL',
autoSaveMessage: 'Otomatik Kaydedildi',
loadSavedContent: 'Bu içeriğin "{0}" tarihli otomatik kaydedilmiş versiyonu bulundu. İki versiyonu karşılaştırmak ve hangisi yüklenmek istediğinizi belirlemek ister misiniz? İptal tuşuna basılınca otomatik kaydedilen içerik silinir.',
title: 'Otomatik olarak kaydedilen içerik ile yüklenen içeriği karşılaştır',
loadedContent: 'Yüklenen içerik',
localStorageFull: 'Tarayıcı belleği(localStorage) dolu, belleği temizleyin veya boyutunu artırın',
autoSavedContent: 'Otomatik kaydedilen içerik: \'',
ok: 'Evet, otomatik kaydedilen içeriği yükle',
no: 'Hayır',
diffType: 'Gösterim tipini seç:',
sideBySide: 'Sutunlu görünüm',
inline: 'Sıralı görünüm'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'uk', {
dateFormat: 'LLL',
autoSaveMessage: 'Автоматичне збереження',
loadSavedContent: 'Знайдено автоматично збережену версію цього вмісту від "{0}". Бажаєте порівняти версії вмісту та вибрати, яку з них завантажити? Якщо натиснути "Скасувати", раніше збережений вміст буде вилучено.',
title: 'Порівняння автоматично збереженого вмісту із поточним',
loadedContent: 'Завантажений вміст',
localStorageFull: 'Локальне сховище(localStorage) браузера заповнено, очистіть сховище або збільшіть розмір бази даних',
autoSavedContent: 'Автоматично збережений вміст від: \'',
ok: 'Так, завантажити автоматично збережений вміст',
no: 'Ні',
diffType: 'Виберіть тип перегляду:',
sideBySide: 'Переглянути поряд',
inline: 'Вбудований вигляд'
});

View File

@ -1,18 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'zh-cn', {
dateFormat: 'LLL',
autoSaveMessage: '自动保存',
loadSavedContent: '已经存在这个内容之前保存的版本 "{0}". 你希望比较两个不同的版本并从中选择你想要加载的那个么?',
title: '比较自动保存的版本',
loadedContent: '已经加载的内容',
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
autoSavedContent: '自动保存的内容: \'',
ok: '我确认,加载自动保存的内容',
no: '取消',
diffType: '选择视图类型:',
sideBySide: '并排视图',
inline: '内嵌视图'
});

View File

@ -1,17 +0,0 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('autosave', 'zh', {
dateFormat: 'LLL',
autoSaveMessage: '自動儲存 :)',
loadSavedContent: '你在 “{0}” 有一個自動儲存的版本。你想要比較新舊內容,並選擇使用哪一個嗎?點取消按鈕將會移除先前的自動儲存紀錄。',
title: '新舊內容比較',
loadedContent: '目前內容',
autoSavedContent: '自動儲存的內容: \'',
ok: '是,我要讀取自動儲存的內容',
no: '否',
diffType: '選擇比較方式:',
sideBySide: '雙欄式',
inline: '條列式'
});

View File

@ -11,7 +11,7 @@
CKEDITOR.plugins.add("autosave",
{
lang: "bg,ca,cs,de,en,es,eu,fr,it,ja,nl,pl,pt-br,ru,sk,sv,uk,zh,zh-cn", // %REMOVE_LINE_CORE%
lang: "en,us,ru", // %REMOVE_LINE_CORE%
requires: "notification",
version: "0.18.6",
init: function(editor) {