Repository: fossasia/open-event-server

Issue:
Images not displayed from sponsors
![screenshot from 2016-12-30 17-04-21](https://cloud.githubusercontent.com/assets/1583873/21568116/154531ec-ceb2-11e6-9592-4eaa6227da3e.png)

Please compare: https://eventyay.com/e/ecc2001a



Discussion:
Going back to the editing tab for sponsors, shows "Google" on each sponsor list.

![screenshot from 2016-12-30 17-08-04](https://cloud.githubusercontent.com/assets/1583873/21568178/9c030e98-ceb2-11e6-9358-d89de46517fb.png)

As images get entered and the user proceeds to the next step, there is actually an error message on the bottom.

![screenshot from 2016-12-31 12-33-57](https://cloud.githubusercontent.com/assets/1583873/21577278/88503378-cf55-11e6-84e7-7bb07106fb87.png)

@mariobehling this is what I get on visiting the link [https://eventyay.com/e/ecc2001a](https://eventyay.com/e/ecc2001a):
![screenshot from 2017-01-03 20-30-13](https://cloud.githubusercontent.com/assets/9530293/21611606/87700974-d1f3-11e6-8fdf-27471e69f25b.png)

Am I missing something?

@SaptakS It was a long process to get these images on the site as a showcase. I had to enter the same image several times.

Please set up an event and add several sponsor images. Then save the event and go back to enter other sponsor images and repeat the process. You will encounter a number of issues and fails to save the data.
@mariobehling ok. I will check it more.
@mariobehling the problem is there is an error in saving. If you notice the snackbar, it is often giving an error for image upload and saving. But the thing is while editing, the wizard proceeds to next step and then gives error for the last step in snackbar, which is why it goes unnoticed. I am checking both of this errors. Will fix them.

Resolving patch:
diff --git a/app/api/helpers/custom_fields.py b/app/api/helpers/custom_fields.py
--- a/app/api/helpers/custom_fields.py
+++ b/app/api/helpers/custom_fields.py
@@ -26,12 +26,6 @@ def format(self, value):
         format the text in database for output
         works only for GET requests
         """
-        if not self.validate(value):
-            print 'Validation of field with value \"%s\" (%s) failed' % (
-                value, str(self.__class__.__name__))
-            # raise MarshallingError
-            # disabling for development purposes as the server crashes when
-            # exception is raised. can be enabled when the project is mature
         if self.__schema_type__ == 'string':
             return unicode(value)
         else:
diff --git a/app/helpers/wizard/sponsors.py b/app/helpers/wizard/sponsors.py
--- a/app/helpers/wizard/sponsors.py
+++ b/app/helpers/wizard/sponsors.py
@@ -16,8 +16,8 @@ def get_sponsors_json(event_id_or_sponsors):
     data = []
     for sponsor in sponsors:
         data.append(sponsor.serialize)
-
-    return data
+ 
+    return sorted(data, key=lambda x: x['id'])
 
 
 def save_sponsors_from_json(json, event_id=None):
@@ -43,12 +43,11 @@ def save_sponsors_from_json(json, event_id=None):
             item.description = sponsor['description']
 
             save_to_db(item)
-
             if item.logo != sponsor['logo']:
                 if sponsor['logo'] and sponsor['logo'] != '':
                     item.logo = save_event_image(sponsor['logo'], UPLOAD_PATHS['sponsors']['logo'].format(
                         event_id=int(event.id), id=int(item.id)
-                    ))
+                    ), remove_after_upload=False)
                 else:
                     item.logo = ''
 


Test patch: