]> git.parisson.com Git - telemeta.git/commitdiff
bugfix
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 15 Jan 2015 11:13:30 +0000 (12:13 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 15 Jan 2015 11:13:30 +0000 (12:13 +0100)
telemeta/models/media.py

index b2dff83232c7f910c9073d1612883757682a8668..2b829980cd60bbaf155fe94bd7a5430b54f7d553 100644 (file)
@@ -363,7 +363,9 @@ class MediaCollection(MediaResource):
         # metadata = model_to_dict(self, fields=[], exclude=self.exclude)
         metadata = self.to_dict()
         for key in self.exclude:
-            del metadata[key]
+            if key in metadata.key():
+                del metadata[key]
+
         metadata['url'] = get_full_url(reverse('telemeta-collection-detail', kwargs={'public_id':self.pk}))
         metadata['doc_status'] = self.document_status()
         metadata['countries'] = ';'.join([location.name for location in self.main_countries()])
@@ -594,7 +596,9 @@ class MediaItem(MediaResource):
         # metadata = model_to_dict(self, fields=[], exclude=self.exclude)
         metadata = self.to_dict()
         for key in self.exclude:
-            del metadata[key]
+            if key in metadata.key():
+                del metadata[key]
+
         metadata['url'] = self.get_url()
         metadata['last_modification_date'] = unicode(self.get_revision().time)
         metadata['collection'] = self.collection.get_url()