def save(self, user, story): if self.cleaned_data['id']: post = StoryLineItem.objects.get(pk=self.cleaned_data['id']) post.text = self.cleaned_data['text'] else: post = StoryLineItem(text=self.cleaned_data['text'], creator=user, story=story) post.save() if self.cleaned_data['lng'] and self.cleaned_data['lat']: location = Point(float(self.cleaned_data['lng']), float(self.cleaned_data['lat'])) pointTag = GeoPointTag(content_object=post, location=location, creator=user) pointTag.save() # add medias if self.cleaned_data["medias"]: media_uids = self.cleaned_data["medias"].split(",") for media_uid in media_uids: media = get_target_object(media_uid.strip()) storylineitem = StoryLineItemMedia(storylineitem=post, content_object=media) storylineitem.save() return post
def storylineitem_attachments(request, template_name="story/attachment_list.html"): itemsUIDs = request.GET.get("items") itemsUIDs = itemsUIDs.split(",") items = [] from misc.utils import get_target_object for uuid in itemsUIDs: items.append(get_target_object(uuid)) return render_to_response(template_name, {"items_list":items}, context_instance=RequestContext(request))