diff --git a/visualization/models.py b/visualization/models.py index ae91c21..408c851 100644 --- a/visualization/models.py +++ b/visualization/models.py @@ -14,7 +14,7 @@ class VisualizationModelDescription(models.Model): description = models.TextField(db_index=True, max_length=350) def __str__(self): - return self.title + " " + self.link + return self.title def __lt__(self, other): try: diff --git a/visualization/views.py b/visualization/views.py index 2d505ac..4b1d3ce 100644 --- a/visualization/views.py +++ b/visualization/views.py @@ -31,12 +31,18 @@ class Index (ListView): def get(self, request, *args, **kwargs): if request.user.is_authenticated(): - userUploadedFiles = UserUploadedFiles.objects.get(user=request.user) - data = { - 'models': self.model, - 'form': self.form_class, - 'files': userUploadedFiles.uploadedFiles - } + try: + userUploadedFiles = UserUploadedFiles.objects.get(user=request.user) + data = { + 'models': self.model, + 'form': self.form_class, + 'files': userUploadedFiles.uploadedFiles + } + except UserUploadedFiles.DoesNotExist: + data = { + 'models': self.model, + 'form': self.form_class + } else: data = { 'models': self.model,