예제 #1
0
 def create(self, request):
     attrs = self.flatten_dict(request.POST)
     space_obj = get_object_or_404(Space, pk=attrs['spaceid'])
     try:
         slug = slugify(attrs['title'])
         tags = attrs.get('tags')
         # The status is a numeric value, see models
         status = Entry.LIVE_STATUS if attrs.get('status') is None else attrs.get('status')
         
         pub_date = attrs.get('pub_date')
         entry = Entry(body=attrs['body'],
                  author=request.user,
                  space=space_obj,
                  title=attrs['title'],
                  slug=slug,
                  tags=tags,
                  status=status,
                  pub_date=pub_date)
     except Exception:
         return "An exception ocurred. This may be due to an ilegal value," \
                 "or mandatory value not initialized"
     entry.save()
     return entry
예제 #2
0
def entries_index(request):
    return render_to_response("coltrane/entry_index.html", {"entry_list": Entry.live()})