Merge branch 'razrab' into feature/create_app

This commit is contained in:
Alex committed 2023-10-03 13:07:22 +03:00
commit 52a60428b2
43 files changed
+690 -295

No files matched your search

BIN
View File
Binary file not shown.
+2 -20
View File
@@ -5,34 +5,16 @@ from django.db.models import Avg
class BaseCriteriaAdmin(admin.ModelAdmin):
list_display=('name', 'rating')
class RatingStatusInline(admin.TabularInline):
model = RatingStatus
fields = ( 'crit', 'rating')
readonly_fields=( 'crit', 'rating')
can_delete = False
show_change_link = False
extra = 0
# class GetRatFilter(admin.SimpleListFilter):
# title = 'get_rat'
# parameter_name = 'get_rat'
# def lookups(self, request, model_admin):
# return (
# ('Yes', 'Yes'),
# ('No', 'No'),
# )
# def queryset(self, request, queryset):
# value = self.value()
# print(self.value(), '---------------------------')
# if value < 5:
# return queryset.filter(comment='Я усталь')
# if value > 5:
# return queryset.filter(comment='qqqq')
class UserCommentAdmin(admin.ModelAdmin):
fields = ( 'comment', ('get_rat', 'user', 'time_create'))
list_display=('user', 'time_create', 'comment', 'get_rat', 'utility')
+2 -2
View File
@@ -8,8 +8,8 @@ class BaseCriteria(models.Model):
rating = models.IntegerField(verbose_name='Рейтинг', default=5, blank=True)
color = models.CharField(verbose_name='Цвет иконки', max_length=150, null=True, blank=True)
class Meta:
verbose_name = "Критерии оценки"
verbose_name_plural = "Критерии оценки"
verbose_name = "Справочник - Критерии оценки"
verbose_name_plural = "Справочник - Критерии оценки"
def __str__(self):
return str(self.name)
+21 -9
View File
@@ -1,17 +1,18 @@
{
"name": "front",
"version": "0.0.10",
"version": "0.0.12",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "front",
"version": "0.0.10",
"version": "0.0.12",
"dependencies": {
"@fullcalendar/core": "^6.1.8",
"@fullcalendar/daygrid": "^6.1.8",
"@fullcalendar/interaction": "^6.1.8",
"@fullcalendar/list": "^6.1.8",
"@fullcalendar/multimonth": "^6.1.9",
"@fullcalendar/timegrid": "^6.1.8",
"@fullcalendar/vue3": "^6.1.8",
"@mdi/font": "7.0.96",
@@ -2695,19 +2696,19 @@
"dev": true
},
"node_modules/@fullcalendar/core": {
"version": "6.1.8",
"resolved": "https://registry.npmjs.org/@fullcalendar/core/-/core-6.1.8.tgz",
"integrity": "sha512-i8JBIvZCWGO9dsMEDcx9bnsQZ9PtGSJdOXGgWbhLaGq2iq41OBdp9g9gM4b/Otv2oK8bL5Gl6CsMmb/HkDtA6Q==",
"version": "6.1.9",
"resolved": "https://registry.npmjs.org/@fullcalendar/core/-/core-6.1.9.tgz",
"integrity": "sha512-eeG+z9BWerdsU9Ac6j16rpYpPnE0wxtnEHiHrh/u/ADbGTR3hCOjCD9PxQOfhOTHbWOVs7JQunGcksSPu5WZBQ==",
"dependencies": {
"preact": "~10.12.1"
}
},
"node_modules/@fullcalendar/daygrid": {
"version": "6.1.8",
"resolved": "https://registry.npmjs.org/@fullcalendar/daygrid/-/daygrid-6.1.8.tgz",
"integrity": "sha512-kCZxQFKb9Vqa3CZRX0v7rMSJ2mlTt4gDpyLfiNJKxUAq7W51uKurPaFZWicaXy1ESHVBxKNlbx5uNjBpyu50JQ==",
"version": "6.1.9",
"resolved": "https://registry.npmjs.org/@fullcalendar/daygrid/-/daygrid-6.1.9.tgz",
"integrity": "sha512-o/6joH/7lmVHXAkbaa/tUbzWYnGp/LgfdiFyYPkqQbjKEeivNZWF1WhHqFbhx0zbFONSHtrvkjY2bjr+Ef2quQ==",
"peerDependencies": {
"@fullcalendar/core": "~6.1.8"
"@fullcalendar/core": "~6.1.9"
}
},
"node_modules/@fullcalendar/interaction": {
@@ -2726,6 +2727,17 @@
"@fullcalendar/core": "~6.1.8"
}
},
"node_modules/@fullcalendar/multimonth": {
"version": "6.1.9",
"resolved": "https://registry.npmjs.org/@fullcalendar/multimonth/-/multimonth-6.1.9.tgz",
"integrity": "sha512-YpH1NL6RzdM1wO2nFJ3pNMo9xhd6i2WuE+e7SnGi7q1lO+ZZ77h5Fja5JKcpuIQUFHpi+m6vTzihIV8DT44NnQ==",
"dependencies": {
"@fullcalendar/daygrid": "~6.1.9"
},
"peerDependencies": {
"@fullcalendar/core": "~6.1.9"
}
},
"node_modules/@fullcalendar/timegrid": {
"version": "6.1.8",
"resolved": "https://registry.npmjs.org/@fullcalendar/timegrid/-/timegrid-6.1.8.tgz",
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "front",
"version": "0.0.10",
"version": "0.0.12",
"scripts": {
"dev": "vite",
"build": "vite build",
@@ -14,6 +14,7 @@
"@fullcalendar/daygrid": "^6.1.8",
"@fullcalendar/interaction": "^6.1.8",
"@fullcalendar/list": "^6.1.8",
"@fullcalendar/multimonth": "^6.1.9",
"@fullcalendar/timegrid": "^6.1.8",
"@fullcalendar/vue3": "^6.1.8",
"@mdi/font": "7.0.96",
Binary file not shown.

After

Width:  |  Height:  |  Size: 593 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

+218
View File
@@ -0,0 +1,218 @@
<template>
<full-calendar :options="calendarOptions" />
</template>
<script>
import {reactive, ref, onMounted} from 'vue'
// import '@fullcalendar/core/vdom'
import FullCalendar from '@fullcalendar/vue3'
import dayGridPlugin from '@fullcalendar/daygrid'
import interactionPlugin from '@fullcalendar/interaction'
import listPlugin from '@fullcalendar/list'
import timeGridPlugin from '@fullcalendar/interaction'
import { axiosApiInstance } from '@/utils/axios-api'
import multiMonthPlugin from '@fullcalendar/multimonth'
export default {
name: 'calendar-full',
props: {
initial: {
type: String,
default: 'multiMonthYear'
}
},
components: {
FullCalendar
},
setup(props) {
const calendarOptions = reactive({
plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin, listPlugin, multiMonthPlugin ],
initialView: props.initial,
dayMaxEventRows: 2,
locale: 'ru',
buttonText: {
today: 'Сегодня',
month: 'Месяц',
week: 'Неделя',
day: 'День',
list: 'Список',
year: 'Год'
},
firstDay:'1',
events: [],
// eventDidMount: function(info) {
// const dayEl = info.el.closest('.fc-daygrid-day')
// dayEl.style.backgroundColor = 'red'
// },
// datesRender: function(info) {
// const start = info.view.activeStart
// const end = info.view.activeEnd
// let daysEls = document.querySelectorAll('.fc-daygrid-day')
// console.log(daysEls , ' info-------------');
// },
editable: true,
headerToolbar: {
left: 'prev',
center: 'title',
right: 'next'
}
,
eventRender: function(eventObj, $el) {
$el.popover({
title: eventObj.title,
content: eventObj.description,
trigger: 'hover',
placement: 'top',
container: 'body'
});
},
// eventDidMount: function(info) {
// console.log(info.event.extendedProps);
// {description: "Lecture", department: "BioChemistry"}
// },
aspectRatio: 1,
multiMonthMaxColumns: 2,
displayEventEnd: true,
height: '100%',
stickyHeaderDates: true,
dayMaxEventRows: 2,
moreLinkContent: function(arg) {
return arg.shortText + ' события'
},
views: {
multiMonthYear: {
moreLinkContent: function(arg) {
return arg.num
},
},
},
allDayText: 'Весь день',
noEventsContent: 'На сегодня событий нет',
selectable: true,
dateClick: (arg) => {
console.log(arg.date);
}
})
function f_generalvacation() {
axiosApiInstance.get('api/general_vacation/generalvacation/')
.then(data => {
for (let x in data.data) {
data.data[x].map(e=>{
let d = new Date(e.planned_date)
// console.log(, 'e---------d.addDays(e.count_days)--------e')
calendarOptions.events.push({ description: 'description for All Day Event', title: x, start: e.planned_date, end: new Date(d.setDate(d.getDate() + e.count_days)).toISOString().split('T')[0]})
}
)
}
console.log(data.data , 'genvacation--------------------');
})
}
onMounted(() => {
f_generalvacation()
})
// genvacation.value[0].planned_date
return { calendarOptions }
}
}
</script>
<style>
#fc-dom-1:first-letter {
text-transform: capitalize;
}
.fc-toolbar {
/* padding: 0px; */
background-color: #f8f8f8;
}
.fc-day-header {
font-weight: bold;
text-align: center;
}
.fc-day {
border: none;
}
.fc-time-grid-event {
background-color: #e6e6e6;
border: none;
color: #000;
}
.fc-event-title {
font-weight: bold;
}
.fc .fc-toolbar.fc-header-toolbar {
padding-bottom: 0.2em;
margin-bottom: 0px;
}
/* .fc .fc-daygrid-day-events {
margin-top: -7px;
} */
.fc {
background-color: #ffffff;
}
.fc-button {
padding: 1px!important;
border-radius: 1em!important;
line-height: 0!important;
background-color: transparent!important;
border-color: transparent!important;
}
.fc-icon {
color: #000;
display: flex;
}
.fc-button:focus, .fc-icon {
outline: none!important;
}
.fc-button,
.fc-buttonactive,
.fc-button:focus {
border:none!important;
}
.fc-header-toolbar {
background: white !important;
}
</style>
-101
View File
@@ -1,101 +0,0 @@
<template>
<full-calendar :options="calendarOptions" />
</template>
<script>
import {reactive, ref, onMounted} from 'vue'
// import '@fullcalendar/core/vdom'
import FullCalendar from '@fullcalendar/vue3'
import dayGridPlugin from '@fullcalendar/daygrid'
import interactionPlugin from '@fullcalendar/interaction'
import listPlugin from '@fullcalendar/list'
import timeGridPlugin from '@fullcalendar/interaction'
import { axiosApiInstance } from '@/utils/axios-api'
export default {
name: 'Calendar',
components: {
FullCalendar
},
setup() {
const calendarOptions = reactive({
plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin, listPlugin ],
initialView: 'dayGridMonth',
locale: 'ru',
buttonText: {
today: 'Сегодня',
month: 'Месяц',
week: 'Неделя',
day: 'День',
list: 'Список'
},
firstDay:'1',
events: [],
editable: true,
headerToolbar: {
left: 'prev, next, today',
center: 'title',
right: 'dayGridMonth, dayGridWeek, dayGridDay, listDay'
},
dateClick: (arg) => {
console.log(arg.date);
}
})
function f_generalvacation() {
axiosApiInstance.get('api/general_vacation/generalvacation/')
.then(data => {
console.log(data.data , 'genvacation--------------------');
calendarOptions.events = [{ title: 'Отпуск', start: '2023-09-01', end: '2023-09-25'}]
})
}
onMounted(() => {
f_generalvacation()
console.log(typeof(huf), 'hu--------------');
})
// genvacation.value[0].planned_date
return { calendarOptions }
}
}
</script>
<style>
.red {
background: rgb(235, 77, 77) !important;
color: whitesmoke !important;
}
.blue {
background: rgb(59, 59, 163) !important;
color: whitesmoke !important;
}
.orange {
background: orange !important;
color: white !important;
}
.green {
background: rgb(49, 155, 49) !important;
color: white !important;
}
.blue,
.orange,
.red,
.green {
font-size: 13px;
font-weight: 500;
text-transform: capitalize;
}
.event-item {
padding: 2px 0 2px 4px !important;
}
</style>
+1 -1
View File
@@ -30,7 +30,7 @@
v-model="feedbackdata.nowrating[key].rating"
hover
half-increments
size="small"
color="yellow-darken-3"
/>
</v-col>
+56 -20
View File
@@ -1,12 +1,15 @@
<template>
<!-- -->
<v-carousel
cover
height="300"
hide-delimiters
hide-delimiter-background
show-arrows="hover"
color="white"
interval="10000"
cover
height="450"
hide-delimiters
hide-delimiter-background
show-arrows="hover"
color="white"
cycle
@@ -15,13 +18,12 @@
<v-carousel-item
v-for="(x, i) in carous" :key="i"
:src="`${burl}${x.link}`"
cover
eager
>
<!-- <my-helper :pretext = 'x'/> -->
<v-container
fill-height
fluid
@@ -29,12 +31,39 @@
class="flex-column h-100 d-flex"
>
<v-card class="bgCard h-100 d-flex flex-column">
<v-card-title class="ma-2 text-h3 text-uppercase titles text-text_carous py-6">
{{x.title}}
<v-card-title class="ma-2 text-h3 text-uppercase titles text-text_carous py-5 flex-column">
<v-row>
<v-col class="pa-0 pl-1 align-self-center">{{x.title}} </v-col>
<!-- {{ burl }} {{ x.sender }} -->
<v-col class="flex-grow-0 pa-0 pr-1">
<v-img
width="50"
:aspect-ratio="1"
:src="`${burl}${x.sender}`"
cover
/>
</v-col>
</v-row>
</v-card-title>
<v-card-text class="ml-2 mb-2 text-black w-50 flex-grow-0 py-3 text-text_carous text-h5 bgText overflow-auto font-weight-medium">
{{x.text}}
<v-card-text class="ml-2 mb-0 mb-2 w-50 flex-grow-0 pb-3 text-h6 bgText overflow-auto ">
<v-textarea
class="text-text_carous mt-n3 text-black textareas pt-2 font-weight-medium"
:model-value=x.text
variant='plain'
readonly
auto-grow
rows="1"
hide-details
/>
</v-card-text>
</v-card>
@@ -48,8 +77,8 @@
</template>
<script>
import { ref } from 'vue'
import {getfromserverfree} from '@/utils/universal_functions'
import { ref, computed } from 'vue'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
@@ -60,13 +89,15 @@ export default {
setup() {
const burl = baseURL.slice(0,-1)
const carous=ref([{link: ""}])
const imageSrcgrupp=computed(()=> {
return new URL(`@/assets/mc.png`, import.meta.url).href;
})
getfromserverfree("api/navigation/carousels/", carous)
getfromserver("api/navigation/carousels/", carous)
return { burl, carous}
return { burl, carous, imageSrcgrupp}
}
}
@@ -80,7 +111,7 @@ export default {
.bgText {
background: #ffffffb0;
line-height: 3.0rem!important;
line-height: 2.1rem!important;
}
@@ -88,4 +119,9 @@ export default {
font-family: cursive !important;
background: #ffffff8c;
}
.textareas .v-field__input {
font-size: 1.3em!important;
}
</style>
+4 -4
View File
@@ -30,12 +30,12 @@
elevation="0"
>
<v-img
<!-- <v-img
height="100"
:src="`${burl}${n.img}`"
cover
class="text-white"
>
> -->
<v-card class="h-100 text-center g text-numeral">
<v-card-title class="statstyle my-2 py-0 text-overline font-weight-bold">
{{n.status}}
@@ -45,7 +45,7 @@
</v-card-text>
</v-card>
</v-img>
<!-- </v-img> -->
</v-card>
@@ -82,7 +82,7 @@ export default {
<style>
.numstyle {
font-size: 2.875rem!important;
line-height: 0.25rem!important;
line-height: 2.5rem!important;
font-family: cursive !important;
background: #ffffffb0;
}
+146 -5
View File
@@ -1,8 +1,11 @@
<template>
<v-container class="py-1 newsVH bg-transparent overflow-auto">
<v-container class="py-1 newsVH px-0 bg-transparent overflow-auto">
<my-helper
:pretext ="newss"
/>
<v-card
class="mx-auto mb-0 "
v-for="(x, i) in newss" :key= i
v-for="(x, i) in newss.newsqueryset" :key= i
>
<v-img
:src="`${burl}${x.link}`"
@@ -37,16 +40,102 @@
<v-expand-transition>
<div v-show="x.show">
<v-divider></v-divider>
<v-divider/>
<v-card-text>
{{x.text}}
</v-card-text>
<v-divider/>
<v-card-actions >
<v-row >
<v-col>
<v-btn
variant="text"
icon="mdi-thumb-up-outline"
color="blue-darken-3"
@click="toggleIncrementLike"
/>
{{ incrementLikes }}
</v-col>
<v-col class=" ml-8">
<v-btn
variant="text"
icon="mdi-message-text-outline"
color="teal"
@click="commentShow=!commentShow"
/>
<!-- @click="commentadd" -->
{{ message }}
<!-- <v-btn
:icon="x.show ? 'mdi-chevron-up' : 'mdi-chevron-down'"
@click="x.show = !x.show"
></v-btn> -->
</v-col>
<v-col class="text-center pr-0">
<v-btn
variant="text"
icon="mdi-thumb-down-outline"
color="red-lighten-2"
@click="toggleDecrementLike"
/>
{{ derementLikes }}
</v-col>
</v-row>
</v-card-actions>
<v-divider class="mb-2"/>
</div>
</v-expand-transition>
<v-expand-transition>
<div v-show="commentShow">
<!-- {{ x.commnet.text }} -->
</div>
</v-expand-transition>
</v-card>
<v-row justify="center">
<v-dialog
v-model="dialogCommentShow"
persistent
width="550"
>
<v-card>
<v-card-title class="text-h5">
Прокоментировать новость
</v-card-title>
<v-card-text>
<v-textarea
variant="solo"
hide-details
rows="5"
></v-textarea>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="blue-darken-1"
variant="text"
@click="dialogCommentShow = false"
>
Отмена
</v-btn>
<v-btn
color="blue-darken-1"
variant="text"
@click="dialogCommentShow = false"
>
Отправить
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</v-container>
</template>
<script>
@@ -55,15 +144,52 @@ import { ref,computed,watch } from 'vue'
import {useAccountStore} from '@/store/AccountStore'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
import myHelper from './UI/my-helper.vue'
const accountStore = useAccountStore()
export default {
components: { myHelper },
setup(){
const newss=ref([])
const show=ref(false)
const incrementLikes = ref(0)
const derementLikes = ref(0)
const likedI = ref(false)
const likedD = ref(false)
const message = ref(0)
const commentShow = ref(false)
const dialogCommentShow = ref(false)
const toggleIncrementLike = () => {
if (likedI.value) {
incrementLikes.value--
}
else {
incrementLikes.value++
if(likedD.value){
derementLikes.value--
likedD.value = false
}
}
likedI.value=!likedI.value
}
const toggleDecrementLike = () => {
if (likedD.value) {
derementLikes.value--
}
else {
derementLikes.value++
if(likedI.value){
incrementLikes.value--
likedI.value = false
}
}
likedD.value=!likedD.value
}
const burl = baseURL.slice(0,-1)
@@ -74,18 +200,33 @@ export default {
getfromserver("api/navigation/news/", newss)
watch(()=>accountStore.cod2user ,(newValue,oldValue)=>{
if(newValue){
getfromserver("api/navigation/news/",newss)
}
}, {deep:true})
const commentadd = () => {
dialogCommentShow.value=!dialogCommentShow.value
// commentShow.value =!commentShow.value
}
return {
newss,
show,
burl,
limitText
limitText,
incrementLikes,
derementLikes,
message,
commentShow,
toggleIncrementLike,
toggleDecrementLike,
dialogCommentShow,
commentadd
}
}
}
+2 -2
View File
@@ -213,7 +213,7 @@
<router-view
/>
<div class="mystat d-flex flex-column">
<!-- <div class="mystat d-flex flex-column">
<v-btn
class="mb-1"
prepend-icon="mdi-wikipedia"
@@ -231,7 +231,7 @@
>
МС
</v-btn>
</div>
</div> -->
</v-main>
<v-navigation-drawer
v-if="accountStore.cod2user"
+1
View File
@@ -4,6 +4,7 @@ import {useAppStore} from '@/store/app'
import { baseURL } from '@/utils/axios-api'
import { axiosApiInstance, clearAxios } from '@/utils/axios-api'
import { useRouter } from 'vue-router'
export function getfromserver(path, reactive){
try{
axiosApiInstance.get(path).then(result => {
+97 -97
View File
@@ -3,100 +3,41 @@
<v-row>
<v-col class="d-flex flex-column" lg=7>
<v-row class="flex-grow-0">
<v-col class="pr-0">
<v-col class="pr-0 pb-0">
<Carousel-list/>
</v-col>
</v-row>
<v-row>
<!-- <v-col class="pt-1 flex-column d-flex mt-3" > -->
<!-- <v-row class="flex-column flex-grow-0 mb-1">
<Carousel-numbers
:digitalData="stat"/>
</v-row> -->
<!-- <v-row class="pt-1 flex-column mt-0 mb-0 "> -->
<!-- <v-card class="d-flex flex-column ml-3">
<div class="fg">
<v-banner
lines="one"
icon="mdi-lock"
color="deep-purple-accent-4"
class="my-4"
>
<v-banner-text>
{{date1}}
</v-banner-text>
<template v-slot:actions>
<v-btn>Action</v-btn>
</template>
</v-banner>
<v-banner
lines="two"
icon="mdi-weather-hurricane"
color="error"
class="my-4"
>
<v-banner-text>
Banner with two lines of text. If the text is too long to fit on two lines then an ellipsis will be used to hide the remaining content. So this next line will be hidden.
</v-banner-text>
<template v-slot:actions>
<v-btn>Action</v-btn>
</template>
</v-banner>
<v-banner
lines="three"
icon="$warning"
color="warning"
class="my-4"
>
<v-banner-text>
Banner with three lines of text. One or two lines is preferable. Three lines should be considered the absolute maximum length on desktop in order to keep messages short and actionable.
</v-banner-text>
<template v-slot:actions>
<v-btn>Action</v-btn>
</template>
</v-banner>
<v-banner
lines="three"
icon="$warning"
color="warning"
class="my-4"
>
<v-banner-text>
Banner with three lines of text. One or two lines is preferable. Three lines should be considered the absolute maximum length on desktop in order to keep messages short and actionable.
</v-banner-text>
<template v-slot:actions>
<v-btn>Action</v-btn>
</template>
</v-banner>
</div>
</v-card> -->
<!-- <Carousel-numbers
:digitalData="onlines"
/> -->
<!-- </v-row> -->
<!-- </v-col> -->
<!-- <v-row>
<v-col class="pt-1 pr-0 pb-0 flex-col">
<calendar/>
<!-- <v-locale-provider > -->
<!-- <v-date-picker
v-model="date1"
class="d-flex pik"
color="teal-accent-4"
/> -->
<!-- </v-locale-provider> -->
<Calendar-full
:initial="'listYear'"
:head=true
/>
</v-col>
</v-row> -->
<v-row>
<v-col class="pr-0 pt-0 flex-column">
<v-card class="h-100 bg-transparent pa-2 d-flex flex-column">
<v-row class="d-flex">
<v-col> <Calendar-full
/></v-col>
<v-col> <Calendar-full
:initial="'listYear'"
/>
</v-col>
</v-row>
</v-card>
</v-col>
<!-- </v-locale-provider> -->
<!-- </v-col> -->
<!-- <v-col>
<v-btn
@click="proba">
@@ -107,8 +48,67 @@
</v-row>
</v-col>
<v-col class="d-flex flex-column justify-space-between px-0 py-2 pb-0" lg=3>
<v-col class="flex-column d-flex flex-grow-0 px-0" lg="2">
<v-row class="flex-grow-1 ma-0 mx-1">
<v-col class="pt-0">
<v-card class="h-100 flex-column">
<v-row v-for="x in stat" :key="x">
<v-col>
<v-card
class="ma-2 d-flex flex-column"
height="100"
elevation="0"
>
<v-card class="h-100 text-center g text-numeral">
<v-card-title class="statstyle py-0 text-overline font-weight-bold">
{{x.status}}
</v-card-title>
<v-card-text class="numstyle mt-2 py-0 font-weight-bold">
<vue3-autocounter ref='counter' :startAmount='0' :endAmount='Number(x.num)' :duration='2'/>
</v-card-text>
</v-card>
<!-- </v-img> -->
</v-card>
</v-col>
<v-divider/>
</v-row>
</v-card>
</v-col>
</v-row>
<v-row class="flex-grow-0 ma-0 mx-1">
<v-col class="py-0">
<v-card class="h-100 flex-colmn"
>
<v-row class="ma-3">
<v-col
v-for="x in 6"
:key="x"
lg=6
class="pa-1"
>
<v-btn
prepend-icon="mdi-wikipedia"
block
variant="outlined"
class="ma-1"
>
Wiki
</v-btn>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-col>
<v-col class="d-flex flex-column justify-space-between px-0 py-2 pr-3 pb-0" lg=3>
<v-card
class="h-100 bg-transparent "
elevation="0"
@@ -140,7 +140,7 @@
import CarouselList from '@/components/carousel-list.vue'
import CarouselNumbers from '@/components/carousel-numbers.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import Calendar from '@/components/UI/calendar.vue'
import CalendarFull from '@/components/UI/Calendar-full.vue'
export default {
@@ -149,7 +149,7 @@
NewsList,
CarouselList,
CarouselNumbers,
Calendar
CalendarFull
},
setup(){
@@ -220,13 +220,13 @@
}
.hicard {
height: 40%!important;
overflow: auto;
height: 40%!important;
overflow: auto;
}
.fg {
height: 240px;
overflow: auto;
height: 240px;
overflow: auto;
}
</style>
+2
View File
@@ -8,5 +8,7 @@ class GeneralVacationAdmin(admin.ModelAdmin):
def get_name(self, obj):
print(obj.user.fio(), '----------------obj.user.fio()')
return obj.user.fio()
admin.site.register(GeneralVacation, GeneralVacationAdmin)
Binary file not shown.

After

Width:  |  Height:  |  Size: 593 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

+29 -1
View File
@@ -1,5 +1,5 @@
from django.contrib import admin
from django.utils.safestring import mark_safe
from .models import *
@@ -12,13 +12,41 @@ class NewsAdmin(admin.ModelAdmin):
super().save_model(request, obj, form, change)
class CarouselsAdmin(admin.ModelAdmin):
list_display=('title', 'cdate', 'enddate', 'get_html_photo', 'link','published', 'sender')
readonly_fields=('get_html_photo',)
list_editable=('link','published', 'cdate', 'enddate', 'sender')
list_filter=('cdate', 'enddate','published')
fields=(('title', 'sender'), 'published', 'text', ('cdate', 'enddate'), ('link','get_html_photo'))
def save_model(self, request, obj, form, change):
if (request.user.username != 'admin') :
obj.author = request.user
else :
obj.author = User.objects.get(id=15)
super().save_model(request, obj, form, change)
def get_html_photo(self, object):
if object.link:
return mark_safe(f"<img src='{object.link.url}' width=50>")
get_html_photo.short_description="Изображение"
class BaseSenderAdmin(admin.ModelAdmin):
list_display=('name', 'get_html_photo', 'img')
list_editable=('img',)
fields=('name', ('img', 'get_html_photo'))
readonly_fields=('get_html_photo',)
def get_html_photo(self, object):
if object.img:
return mark_safe(f"<img src='{object.img.url}' width=50>")
get_html_photo.short_description="Изображение"
admin.site.register(Links)
admin.site.register(News,NewsAdmin)
admin.site.register(Carousels,CarouselsAdmin)
admin.site.register(BaseSender, BaseSenderAdmin)
+3
View File
@@ -4,3 +4,6 @@ from django.apps import AppConfig
class NavigationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'navigation'
verbose_name = "Навигация"
+58 -18
View File
@@ -3,39 +3,79 @@ from accounts.models import *
# Create your models here.
from django.conf import settings
class BaseSender(models.Model):
name = models.CharField(verbose_name='Название', max_length=150, blank=True, db_index=True)
img = models.ImageField(verbose_name='Картинка', null=True, blank=True, upload_to='senderimage')
class Meta:
verbose_name = "Справочник - Тематика"
verbose_name_plural = "Справочник - Тематика"
def __str__(self):
return str(self.name)
class Links(models.Model):
name = models.CharField(db_index=True, max_length=255)
link = models.CharField(db_index=True, max_length=255)
imagecode = models.CharField(db_index=True, max_length=25)
order = models.IntegerField()
name = models.CharField(db_index=True, max_length=255, verbose_name='Заголовок')
link = models.CharField(db_index=True, max_length=255, verbose_name='Ссылка')
imagecode = models.CharField(db_index=True, max_length=25, verbose_name='Иконка')
order = models.IntegerField(verbose_name='Порядок сортировки')
class Meta:
verbose_name = "Ссылка на ресурс"
verbose_name_plural = "Ссылки на ресурсы"
def __str__(self):
return str(self.name)
class News(models.Model):
title=models.CharField( max_length=255)
text= models.TextField(null=True)
cdate =models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT)
link = models.ImageField(upload_to='newsimage/%Y/%m/%d', null=True, default="newsimage/default.jpg")
title=models.CharField(max_length=255, verbose_name='Заголовок')
text= models.TextField(null=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='Изображение')
class Meta:
verbose_name = "Новостная лента"
verbose_name_plural = "Новостная лента"
def __str__(self):
return str(self.title)
class ScoreNews(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор')
score = models.BooleanField(default=None, null=True, verbose_name='Оценка лайк/дизлайк')
# text= models.TextField(null=True, verbose_name='Сообщение')
cdate =models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
news = models.ForeignKey(News, on_delete=models.PROTECT, related_name='get_news', verbose_name='Новость')
class Meta:
verbose_name = "Коммантарий новости"
verbose_name_plural = "Коммантарии новостей"
def __str__(self):
return str(self.author)
class Carousels(models.Model):
title=models.CharField( max_length=255)
text= models.TextField(null=True)
cdate =models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT)
link = models.ImageField(upload_to='newsimage/%Y/%m/%d', null=True, default="newsimage/default.jpg")
published = models.BooleanField(default=False, verbose_name='Опубликован')
order = models.IntegerField(default=False)
title=models.CharField( max_length=255, verbose_name='Заголовок')
text= models.TextField(null=True, verbose_name='Сообщение')
cdate =models.DateTimeField(default=datetime.now(), 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='Картинка')
published = models.BooleanField(default=True, verbose_name='Опубликован')
enddate = models.DateTimeField(default=datetime.now().replace(hour=23,minute=0,second=0,microsecond=0) + timedelta(days=7), verbose_name='Дата снятия с публикации')
sender = models.ForeignKey(BaseSender, on_delete=models.PROTECT, related_name='get_sender', verbose_name='Тематика')
class Meta:
verbose_name = "Карусель новостей"
verbose_name_plural = "Карусель новостей"
def __str__(self):
return str(self.title)
+6
View File
@@ -18,4 +18,10 @@ class CarouselsSerializer(serializers.ModelSerializer):
class Meta:
model = Carousels
fields = '__all__'
class ScoreNewsSerializer(serializers.ModelSerializer):
class Meta:
model = ScoreNews
fields = '__all__'
+39 -13
View File
@@ -6,6 +6,8 @@ from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from .serializers import *
from userauth.models import *
from general_vacation.models import *
from django.db.models import Q
class LinkAPIView(ListAPIView):
permission_classes = (AllowAny,)
@@ -21,24 +23,35 @@ class LinkAPIView(ListAPIView):
class NewsAPIView(ListAPIView):
permission_classes = (AllowAny,)
serializer_class = NewsSerializer
def get(self, request):
queryset = News.objects.all().order_by('cdate')[:10]
newsqueryset = News.objects.all().order_by('cdate')[:10]
scorenews = ScoreNews.objects.all()
# Сериализуем извлечённый набор записей
# serializer_for_newsqueryset = NewsSerializer(
# instance=newsqueryset, # Передаём набор записей
# many=True # Указываем, что на вход подаётся именно набор записей
# )
# comment = CommnetNews.objects.filter(news=2).exists()
# print(comment, '==============')
# serializer = self.serializer_class(queryset, many=True)
# print(serializer.data)
result = []
for x in queryset:
for x in newsqueryset:
print(x.get_news.all())
a=model_to_dict(x)
a['link']= str(x.link.url)
a['show'] = False
a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username))
a['scores'] = [{"score":y.score} for y in x.get_news.all()]
# if CommnetNews.objects.filter(news=x.pk).exists():
# a['commnet'] = model_to_dict(CommnetNews.objects.get(news=x.pk))
result.append(a)
return Response(result)
return Response({"newsqueryset":result})
class CarouselsAPIView(ListAPIView):
permission_classes = (AllowAny,)
@@ -46,18 +59,31 @@ class CarouselsAPIView(ListAPIView):
def get(self, request):
queryset = Carousels.objects.filter(published=True).order_by('order')
# serializer = self.serializer_class(queryset, many=True)
# print(serializer.data)
queryset = Carousels.objects.filter(published=True, cdate__lte=datetime.now(), enddate__gte=datetime.now()).order_by('-cdate')
vacation = GeneralVacation.objects.filter(user_id=request.user.id, planned_date__lte=datetime.now() + timedelta(days=7))
# print(vacation, '-----------------')
# if vacation:
# Carousels.objects.update(published=True)
# else:
# Carousels.objects.filter().update(published=False)
# Carousels.objects.update_or_create(id=request.data['nowcomment']['id'],user_id=15, defaults={'comment':request.data['nowcomment']['comment'], 'time_create':datetime.datetime.now()})
result = []
for x in queryset:
for x in queryset:
a=model_to_dict(x)
a['link']= str(x.link.url)
a['show'] = False
a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username))
result.append(a)
if x.sender.img:
a['sender'] = str(x.sender.img.url)
else:
a['sender'] = None
result.append(a)
return Response(result)
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -19,7 +19,7 @@ class Counter(ListAPIView):
# return Response(qs)
def post(self, request):
print(request.data['user__id'])
# print(request.data['user__id'])
if request.data['user__id'] is not None:
# print("sdddddd")
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),page=request.data['page'], visitdate=date.today())