Новости с картинками

This commit is contained in:
iriska-gri committed 2023-11-29 10:23:45 +03:00
1 parent 168b58d297
commit 7c07190261
6 files changed
+21 -6

No files matched your search

+16 -5
View File
@@ -217,7 +217,12 @@
<v-row class="ma-0 my-3 overflow-auto h-0">
<v-col class="pa-0">
<v-card-text class="pt-0">
{{x.text}}
<div v-html=formatText(x.text)>
</div>
</v-card-text>
</v-col>
</v-row>
@@ -226,8 +231,8 @@
</v-row>
</v-col>
<v-col class="flex-column d-flex">
<!-- <v-row class="flex-grow-0">
<v-col class="bg-red pb-0 ">
<v-row class="flex-grow-0">
<v-col class="pb-0 ">
<v-card
height="350px"
@@ -235,7 +240,7 @@
1
</v-card>
</v-col>
</v-row> -->
</v-row>
<v-row >
<v-col class="">
<v-card
@@ -755,6 +760,11 @@ export default {
idnews.value = news
}
const formatText= (text) => {
return text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`)
}
const limitText=(text)=> {
@@ -791,7 +801,8 @@ export default {
selecnews,
checkremote,
route,
spravURL
spravURL,
formatText
Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

+4 -1
View File
@@ -2,6 +2,8 @@ from django.db import models
from accounts.models import *
# Create your models here.
from django.conf import settings
from ckeditor.fields import RichTextField
from ckeditor_uploader.fields import RichTextUploadingField
class BaseSender(models.Model):
name = models.CharField(verbose_name='Название', max_length=150, blank=True, db_index=True)
@@ -34,7 +36,8 @@ class Links(models.Model):
class News(models.Model):
title=models.CharField(max_length=255, verbose_name='Заголовок')
text= models.TextField(null=True, verbose_name='Сообщение')
text= RichTextUploadingField(null=True, blank= True, verbose_name='Текст новости')
cdate =models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор')
link = models.ImageField(upload_to='newsimage/%Y/%m/%d', null=True, default="newsimage/default.jpg", verbose_name='Изображение')
+1
View File
@@ -8,6 +8,7 @@ urlpatterns = [
path('links/', LinkAPIView.as_view(), name='LinkAPIView'),
path('news/', NewsAPIView.as_view(), name='NewsAPIView'),
path('carousels/', CarouselsAPIView.as_view(), name='CarouselsAPIView'),
path('ckeditor/', include('ckeditor_uploader.urls'))