fix add-note form action and server handling for save
authorSeth Woodworth <seth@sethish.com>
Thu, 21 Mar 2013 19:02:52 +0000 (15:02 -0400)
committerSeth Woodworth <seth@sethish.com>
Thu, 21 Mar 2013 19:02:52 +0000 (15:02 -0400)
karmaworld/apps/notes/views.py
karmaworld/assets/js/lightboxupload.js

index 9a78b70a17a8b27579a5e6ce0f5445c32e19c8e7..0f9e37e2e4f9b1c2193ee56c4fca659ada49db10 100644 (file)
@@ -33,6 +33,7 @@ class NoteSaveView(FormView, SingleObjectMixin):
         context = {
             'object': self.get_object(),
         }
+        print "get context for NoteSaveView"
         return super(NoteSaveView, self).get_context_data(**context)
 
     def get_success_url(self):
@@ -51,7 +52,7 @@ class NoteSaveView(FormView, SingleObjectMixin):
         """
         self.object = self.get_object()
         self.object.name = form.cleaned_data['name']
-        self.object.desc = form.cleaned_data['desc']
+        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'])
         self.object.save()
@@ -59,6 +60,7 @@ class NoteSaveView(FormView, SingleObjectMixin):
 
     def form_invalid(self, form):
         """ Do stuff when the form is invalid !!! TODO """
+        print "running form_invalid"
         print self.form
         print self.form.errors
 
index 582d30c0d3f6d202622237f7c9641f0328ede29b..a38dd9ba2415bec8c1dbdf7c44380501bec6ad65 100644 (file)
@@ -29,11 +29,13 @@ $(function(){
       onComplete: function( id, fileName, responseJSON ) {
         if( responseJSON.success ) {
           // activate the form for submitting
-          $('form#upload_form').attr('action', responseJSON.note_url);
+          $('form#add-note').attr('action', responseJSON.note_url);
           // inform the user of success
           $('#add-note-status').text('Uploaded');
           // TODO: activate the save button
           $('#save-btn').removeClass('disabled');
+          // add the save url to form as ACTION
+
           // add a click handler to submit the add-note form
           $('#save-btn').click(function(){
             $('form#add-note').submit();