package com.example.timestat.dto
import java.util.*
class EventDto(
val id: Long?,
val name: String,
val description: String,
val date: Date,
val approved: Boolean,
val type: String,
val sourceHref: String,
val subject: Long
)
https://cloud.google.com/translate/pricing говорит совсем другое.
Пришлите пож-ста ссылку на
channel_layer = get_channel_layer()
class GetRecalculate(APIView):
def post(self, request):
parameters = get_search_parameters(request)
filepath = get_recalculate(request.FILES['file'], **parameters)
return FileResponse(open(filepath, 'rb'), as_attachment=True, filename='Пересчет ASIST.xlsx')
def send_progress(token: str, progress_data: dict):
text_data = json.dumps(progress_data, cls=encoders.JSONEncoder, ensure_ascii=False)
async_to_sync(channel_layer.group_send)(
f"progress-{token}", {"type": "progress", "message": text_data}
)
def get_recalculate(f, *args, **kwargs):
...
send_progress(kwargs["token"], progress_data)
...
send_progress(kwargs["token"], progress_data)
....
return recalculate
class ProgressConsumer(WebsocketConsumer):
def connect(self):
self.room_name = self.scope["url_route"]["kwargs"]["token"]
self.room_group_name = f"progress-{self.room_name}"
async_to_sync(self.channel_layer.group_add)(self.room_group_name, self.channel_name)
self.accept()
def disconnect(self, close_code):
async_to_sync(self.channel_layer.group_discard)(self.room_group_name, self.channel_name)
def receive(self, text_data=None, bytes_data=None):
text_data_json = json.loads(text_data)
message = text_data_json['message']
async_to_sync(self.channel_layer.group_send)(self.room_group_name, {
'type': text_data_json["type"],
'message': message
})
def progress(self, event):
self.send(text_data=event["message"])
https://django.fun/docs/django/5.0/topics/db/aggre...