How to show sorted list in form
This works but dont know how to show in my page
sorted(glob.glob(''+dvcs.hostname+''), key=os.path.getmtime)
I dont know what should I do. Here is my code
class Recentbackups(View):
@staticmethod
def get(request, pk):
dvcs = Device.objects.filter(pk=pk)
form = DeviceForm()
context = {'dvcs': dvcs, 'form': form}
return render(request, 'Recentbackups.html', context)
at the moment youre just sending the objects dvcs and form to the Recentbackups.html as a Dictionary. Now you need to use it.
In the Recentbackups.html:
You can now access the variables via {{dvcs}} or {{form}} directly in the Recentbackups.html.
I don´t know what exactly is the content of the variables, but you can for example loop over them (if they are a list) and print then something for each object. example:
{%for obj in form%}
<div>{obj}</div>
{%endfor%}
hope that helps in generell :D