update : 22.07.2025 12:15:04,60

This commit is contained in:
Sabron 2025-07-22 12:15:04 +07:00
parent 558d4c1c8d
commit 4d2a9c615f
8 changed files with 91 additions and 20 deletions

View File

@ -54,7 +54,12 @@ class Event(models.Model): # События пользователя
null=True,
verbose_name=u'Автор')
def get_read_date_time(self):
if self.read_date_time is None:
return ''
else:
return self.read_date_time
def __str__(self):
"""

View File

@ -109,7 +109,9 @@
<thead>
<tr role="row">
<th style="width:10px;"> </th>
<th style="width: 15px;">Дата и время</th>
<th style="width: 15px;">Дата события</th>
<th style="width: 15px;">Дата прочтения</th>
<th style="width: 15px;">Автор</th>
<th >Событие</th">
</tr>
</thead>
@ -142,6 +144,16 @@
{{ catalog.date_time }}
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.get_read_date_time}}
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.autor }}
</a>
</td>
<td>
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.text_event }}
@ -149,7 +161,7 @@
</td>
</tr>
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-backdrop="static">
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-id="{{catalog.id}}" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" {% if catalog.level_event > 2 %} style="background-color:red;" {%endif%} >
@ -192,7 +204,7 @@
<label for="id_name" class="col-sm-3 col-form-label">Время прочтения: </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="{{ catalog.read_date_time}}">
<input class="form-control" type="text" readonly value="{{ catalog.get_read_date_time}}">
</div>
</div>
<div class="form-group row">
@ -267,5 +279,9 @@ async function exit_modal(id)
$('#modal-edit_'+id).modal('hide')
}
}
$('.modal').on('hidden.bs.modal', async function (e) {
exit_modal(e.currentTarget.getAttribute('data-id'))
location.reload()
})
</script>
{% endblock script_footer %}

View File

@ -109,7 +109,9 @@
<thead>
<tr role="row">
<th style="width:10px;"> </th>
<th style="width: 15px;">Дата и время</th>
<th style="width: 15px;">Дата события</th>
<th style="width: 15px;">Дата прочтения</th>
<th style="width: 15px;">Автор</th>
<th >Событие</th">
</tr>
</thead>
@ -141,6 +143,16 @@
{{ catalog.date_time }}
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.get_read_date_time}}
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.autor }}
</a>
</td>
<td>
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.text_event }}
@ -148,7 +160,7 @@
</td>
</tr>
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-backdrop="static">
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-id="{{catalog.id}}" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" {% if catalog.level_event > 2 %} style="background-color:red;" {%endif%} >
@ -191,7 +203,7 @@
<label for="id_name" class="col-sm-3 col-form-label">Время прочтения: </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="{{ catalog.read_date_time}}">
<input class="form-control" type="text" readonly value="{{ catalog.get_read_date_time}}">
</div>
</div>
<div class="form-group row">
@ -266,5 +278,10 @@ async function exit_modal(id)
$('#modal-edit_'+id).modal('hide')
}
}
$('.modal').on('hidden.bs.modal', async function (e) {
exit_modal(e.currentTarget.getAttribute('data-id'))
location.reload()
})
</script>
{% endblock script_footer %}

View File

@ -109,7 +109,8 @@
<thead>
<tr role="row">
<th style="width:10px;"> </th>
<th style="width: 15px;">Дата и время</th>
<th style="width: 15px;">Дата события</th>
<th style="width: 15px;">Дата прочтения</th>
<th >Событие</th">
</tr>
</thead>
@ -125,8 +126,7 @@
{% else %}
background-color:red;
{% endif %}
"
>
">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
<i class="fas fa-info"></i>
</a>
@ -137,13 +137,18 @@
{{ catalog.date_time }}
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.get_read_date_time}}
</a>
</td>
<td>
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.text_event }}
</a>
</td>
</tr>
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-backdrop="static">
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-id="{{catalog.id}}" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" {% if catalog.level_event > 2 %} style="background-color:red;" {%endif%} >
@ -186,7 +191,7 @@
<label for="id_name" class="col-sm-3 col-form-label">Время прочтения: </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="{{ catalog.read_date_time}}">
<input class="form-control" type="text" readonly value="{{ catalog.get_read_date_time}}">
</div>
</div>
<div class="form-group row">
@ -195,13 +200,13 @@
<textarea class="form-control" disabled="">{{catalog.text_event}}</textarea>
</div>
</div>
<div class="form-group row">
<!--<div class="form-group row">
<label for="id_name" class="col-sm-3 col-form-label">Автор: </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="{{ catalog.autor}}">
</div>
</div>
</div>-->
</div>
<div class="modal-footer justify-content-between">
@ -264,5 +269,10 @@ async function exit_modal(id)
$('#modal-edit_'+id).modal('hide')
}
}
$('.modal').on('hidden.bs.modal', async function (e) {
exit_modal(e.currentTarget.getAttribute('data-id'))
location.reload()
})
</script>
{% endblock script_footer %}

View File

@ -109,7 +109,9 @@
<thead>
<tr role="row">
<th style="width:10px;"> </th>
<th style="width: 15px;">Дата и время</th>
<th style="width: 15px;">Дата события</th>
<th style="width: 15px;">Дата прочтения</th>
<th style="width: 15px;">Автор</th>
<th >Событие</th">
</tr>
</thead>
@ -141,6 +143,16 @@
{{ catalog.date_time }}
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.get_read_date_time}}
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.autor }}
</a>
</td>
<td>
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.text_event }}
@ -148,7 +160,7 @@
</td>
</tr>
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-backdrop="static">
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-id='{{catalog.id}}' data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" {% if catalog.level_event > 2 %} style="background-color:red;" {%endif%} >
@ -191,7 +203,7 @@
<label for="id_name" class="col-sm-3 col-form-label">Время прочтения: </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="{{ catalog.read_date_time}}">
<input class="form-control" type="text" readonly value="{{ catalog.get_read_date_time}}">
</div>
</div>
<div class="form-group row">
@ -261,10 +273,14 @@ async function exit_modal(id)
});
let result = await response.json();
console.log(result)
if (result.status=='ok'){
$('#modal-edit_'+id).modal('hide')
}
}
$('.modal').on('hidden.bs.modal', async function (e) {
exit_modal(e.currentTarget.getAttribute('data-id'))
location.reload()
})
</script>
{% endblock script_footer %}

View File

@ -78,7 +78,8 @@ def event_viewer(request):
try:
post_param = request.POST.dict()
event = Event.objects.filter(id=post_param['id']).first()
event.read_date_time = timezone.now()
if event.read_date_time is None:
event.read_date_time = timezone.now()
event.viewed = True
event.save()
data =dict()
@ -464,7 +465,8 @@ def view_events(request):
'field':event.url_field.replace("/media/","")
})
event.viewed = True
event.read_date_time =datetime.now()
if event.read_date_time is None:
event.read_date_time =datetime.now()
event.save()
return render(request,'event_view.html', context)

View File

@ -306,6 +306,9 @@ def load_sigi(**kwargs):
dist = kwargs["dist"]
data = dict()
data.update(cmd="get_events")
data_sql_here = dict()
data_sql_here.update(__limit=100)
data.update(sql_where=data_sql_here)
Headers = {"accept": "application/json", "Content-type": "application/json"}
response = requests.post(

View File

@ -343,6 +343,7 @@
<p>Администрирование</p></a
>
</li>
{%endif%}
<li class="nav-header"></li>
<li class="nav-item">
<a href="/events/system/" class="nav-link">
@ -350,6 +351,7 @@
<p>События</p></a
>
</li>
{% if user.profile.role == 1 %}
<li class="nav-header"></li>
<li class="nav-item">
<a href="/about/" class="nav-link">