def ver_repo(request): data = {"bloque": "repo", "plugins": plugins_availables()} filter_by = {"deleted": False} repo = githelper.repository if repo: data["blobs"] = [] for stage, blob in githelper.get_blobs(repo): data["blobs"].append(blob) return render(request, "main/blobs.html", {"data": data})
def rebuild(request): """Rebuild the whole database from the images repository. Entries in all tables, main and plugins, are lost and systematically rebuilt from the current contents of the repostory. """ # Due to the on-delete-cascade behavious of Django's ORM, deleting an # Imagenes entry consecuently deletes all entries in any plugin table that # are pointing to it. Since all entries in plugin tables should point to a # Imagenes instance, this should be enought to trigger a controlled chaos. Imagenes.objects.all().delete() # This does not use truncate. We should. # Recreate the entry in the Imagenes table, and process by each plugin. for stage, blob in githelper.get_blobs(githelper.repository): image = Imagenes(filehash=blob.hexsha) image.save() main.interface.process_image(image) return vomit(request, True)