You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.2 KiB

from django.core.files.base import ContentFile
from django.shortcuts import render
from django.template.loader import render_to_string
from django.views.generic import TemplateView, View
import logging
from chat.models import Documents
from common.models import MainPage, PrintDocuments
from projects.models import Order
from users.models import ContractorResumeFiles
from work_sell.models import Picture
class HomeTemplateView(View):
template_name = 'home.html'
def get(self, request, *args, **kwargs):
main_settings = MainPage.objects.get(pk=1)
return render(request, self.template_name, {'main_settings': main_settings})
class TestChatTemplateView(View):
template_name = 'chat_test.html'
def get(self, request, *args, **kwargs):
test = [54,55,56]
for pk in test:
picture = Picture.objects.get(pk=pk)
temp_file = ContentFile(picture.file.read())
temp_file.name = picture.file.name
document = Documents()
document.team_id = 1
document.order_id = 2
document.sender_id = 2
document.recipent_id = 4
document.file = temp_file
document.save()