Merge branch 'testing' into without-teal
This commit is contained in:
commit
dcae036271
|
@ -1293,6 +1293,8 @@ class TradeDocumentForm(FlaskForm):
|
|||
).one()
|
||||
kwargs['obj'] = self._obj
|
||||
|
||||
if self._obj:
|
||||
self.file_name.args = ()
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
if self._obj:
|
||||
|
@ -1313,6 +1315,10 @@ class TradeDocumentForm(FlaskForm):
|
|||
def save(self, commit=True):
|
||||
file_name = ''
|
||||
file_hash = ''
|
||||
if self._obj:
|
||||
file_name = self._obj.file_name
|
||||
file_hash = self._obj.file_hash
|
||||
|
||||
if self.file_name.data:
|
||||
file_name = self.file_name.data.filename
|
||||
file_hash = insert_hash(self.file_name.data.read(), commit=False)
|
||||
|
@ -1393,6 +1399,8 @@ class DeviceDocumentForm(FlaskForm):
|
|||
).one()
|
||||
kwargs['obj'] = self._obj
|
||||
|
||||
if self._obj:
|
||||
self.file_name.args = ()
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
if self._obj:
|
||||
|
@ -1410,6 +1418,10 @@ class DeviceDocumentForm(FlaskForm):
|
|||
def save(self, commit=True):
|
||||
file_name = ''
|
||||
file_hash = ''
|
||||
if self._obj:
|
||||
file_name = self._obj.file_name
|
||||
file_hash = self._obj.file_hash
|
||||
|
||||
if self.file_name.data:
|
||||
file_name = self.file_name.data.filename
|
||||
file_hash = insert_hash(self.file_name.data.read(), commit=False)
|
||||
|
|
|
@ -214,6 +214,8 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th scope="col">File</th>
|
||||
<th scope="col">Type</th>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col" data-type="date" data-format="YYYY-MM-DD hh:mm">Uploaded on</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
@ -230,8 +232,16 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ doc.created.strftime('%Y-%m-%d %H:%M')}}
|
||||
{{ doc.type }}
|
||||
</td>
|
||||
<td>
|
||||
{% if doc.description %}
|
||||
{{ doc.description|truncate(30, True) }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ doc.created.strftime('%Y-%m-%d %H:%M') }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('inventory.device_document_edit', dhid=doc.device.dhid, doc_id=doc.id) }}" title="Edit document">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
|
|
|
@ -529,6 +529,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th scope="col">File</th>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col" data-type="date" data-format="YYYY-MM-DD hh:mm">Uploaded on</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
@ -543,6 +544,11 @@
|
|||
{{ doc.file_name}}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if doc.description %}
|
||||
{{ doc.description|truncate(30, True) }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ doc.created.strftime('%Y-%m-%d %H:%M')}}
|
||||
</td>
|
||||
|
|
Reference in a new issue