@@ -131,13 +131,14 @@
- {% if standard.addedfiles.all|length > 0 %}
+ {% if standard.addedfiles_nc.all|length > 0 %}
Dateien
- {% for files in standard.addedfiles.all %}
- {{files.name|truncatechars:30}}
+ {% for files in standard.addedfiles_nc.all %}
+
+ TODO: HIER DOWNLOAD ERMÖGLICH: {{files.nc_id}}
{% endfor %}
diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc
index 1d330fb..43c023f 100644
Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ
diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py
index 0d81ed1..12b367c 100644
--- a/standards/templatetags/counter_tag.py
+++ b/standards/templatetags/counter_tag.py
@@ -1121,7 +1121,6 @@ import urllib.parse
@register.simple_tag
def getNCFileInfos(request, ncid):
try:
- print(ncid)
filesearchdata = '
/files/' + request.user.username + 'infinity' + str(ncid) + ''
r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav/", data=filesearchdata, headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid})
diff --git a/standards/views.py b/standards/views.py
index 1e5ee2d..80dcc62 100644
--- a/standards/views.py
+++ b/standards/views.py
@@ -333,7 +333,7 @@ def StandardAdd(request, id=False):
standard.visibleby.clear()
standard.linked_standards.clear()
- standard.addedfiles.clear()
+ standard.addedfiles_nc.clear()
standard.addedquicklinks.clear()
standard.addedpasswords.clear()
standard.addedcontacts.clear()
@@ -389,10 +389,23 @@ def StandardAdd(request, id=False):
standard.linked_standards.add(Standards.objects.get(pk=s))
# ADD FILES
+ print("FILES IDS")
+ print(normalForm.cleaned_data['added_files'])
files = normalForm.cleaned_data['added_files'].split(",")
for f in files:
+ print(f)
if(f.isdigit()):
- standard.addedfiles.add(DataFile.objects.get(pk=f))
+ print("PRÜFUNG")
+ ncfile = NCFile.objects.filter(nc_id=f).first()
+ # Wenn die NC-File in Django nicht existiert, dann neu erstellen und hinzufügen. Trifft für Dateien zu, die zwar in den Dateien waren, aber noch nicht in der NC!
+ if(ncfile == None):
+ print("NICHT GEFUNDEN - HINZUFÜGEN")
+ new_nc_file = NCFile(nc_id=f, agency=standard.agency)
+ new_nc_file.save()
+ standard.addedfiles_nc.add(new_nc_file)
+ else:
+ print("GEFUNDEN - HINZU")
+ standard.addedfiles_nc.add(ncfile)
# ADD QUICKLINKS
quicklinks = normalForm.cleaned_data['added_quicklinks'].split(",")