Merge pull request 'timestamp' (#54) from timestamp into main
Reviewed-on: #54
This commit is contained in:
commit
ea6db98c0e
|
@ -35,10 +35,8 @@ class DashboardView(LoginRequiredMixin):
|
|||
context = super().get_context_data(**kwargs)
|
||||
lot_tags = LotTag.objects.filter(
|
||||
owner=self.request.user.institution,
|
||||
inbox=False
|
||||
)
|
||||
context.update({
|
||||
"inbox": LotTag.objects.get(inbox=True).name,
|
||||
"commit_id": settings.COMMIT,
|
||||
'title': self.title,
|
||||
'subtitle': self.subtitle,
|
||||
|
|
|
@ -129,15 +129,14 @@
|
|||
{% trans 'Lots' %}
|
||||
</a>
|
||||
<ul class="flex-column mb-2 ul_sidebar accordion-collapse {% if path == 'tags' or path == 'lot' or path in 'unassigned dashboard' %}expanded{% else %}collapse{% endif %}" id="ul_lots" data-bs-parent="#sidebarMenu">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if path == 'unassigned' %} active2{% endif %}" href="{% url 'dashboard:unassigned' %}">
|
||||
{{ inbox }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% for tag in lot_tags %}
|
||||
<li class="nav-items">
|
||||
{% if tag.inbox %}
|
||||
<a class="nav-link{% if path == 'unassigned' %} active2{% endif %}" href="{% url 'dashboard:unassigned' %}">
|
||||
{% else %}
|
||||
<a class="nav-link{% if path == 'tags' %} active2{% endif %}" href="{% url 'lot:tags' tag.id %}">
|
||||
{% endif %}
|
||||
{{ tag.name }}
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -360,7 +360,7 @@ class Device:
|
|||
def updated(self):
|
||||
"""get timestamp from last evidence created"""
|
||||
self.get_last_evidence()
|
||||
return self.last_evidence.created
|
||||
return self.last_evidence.get_time_created()
|
||||
|
||||
@property
|
||||
def serial_number(self):
|
||||
|
|
|
@ -135,9 +135,11 @@ class Evidence:
|
|||
if not self.doc:
|
||||
self.get_doc()
|
||||
self.created = self.doc.get("endTime")
|
||||
|
||||
if not self.created:
|
||||
self.created = self.properties.last().created
|
||||
self.created = self.get_time_created()
|
||||
|
||||
def get_time_created(self):
|
||||
return self.properties.last().created.isoformat()
|
||||
|
||||
def get_components(self):
|
||||
if self.is_legacy():
|
||||
|
|
|
@ -87,6 +87,14 @@ class EditLotView(DashboardView, UpdateView):
|
|||
kwargs = super().get_form_kwargs()
|
||||
return kwargs
|
||||
|
||||
def get_form(self):
|
||||
form = super().get_form()
|
||||
form.fields["type"].queryset = LotTag.objects.filter(
|
||||
owner=self.request.user.institution,
|
||||
inbox=False
|
||||
)
|
||||
return form
|
||||
|
||||
|
||||
class AddToLotView(DashboardView, FormView):
|
||||
template_name = "list_lots.html"
|
||||
|
|
Loading…
Reference in a new issue