Only overwrite the name of a newly uploaded file iff the user actualy entered a name...
authorCharles Holbrow <charlesholbrow@gmail.com>
Thu, 18 Apr 2013 18:02:08 +0000 (14:02 -0400)
committerCharles Holbrow <charlesholbrow@gmail.com>
Thu, 18 Apr 2013 18:02:08 +0000 (14:02 -0400)
karmaworld/apps/notes/views.py

index 9fc83ca80980cf4ad0b9cf778624ff0f0c11a13a..d2865a2233d22e81ca6fa3d4401d67d09485cead 100644 (file)
@@ -50,7 +50,8 @@ class NoteSaveView(FormView, SingleObjectMixin):
             namely, saving the new data to the existing note object
         """
         self.object = self.get_object()
-        self.object.name = form.cleaned_data['name']
+        if len(form.cleaned_data['name']) > 0:
+            self.object.name = form.cleaned_data['name']
         self.object.year = form.cleaned_data['year']
         # use *arg expansion to pass tags a list of tags
         self.object.tags.add(*form.cleaned_data['tags'])