@handle_response_format
@treeio_login_required
def mlist_add(request, response_format='html'):
 user = request.user.profile
 if request.POST:
  mlist = MailingList()
  form = MailingListForm(user, request.POST, instance=mlist)
  if form.is_valid():
   mlist = form.save()
   mlist.set_user_from_request(request)
   return HttpResponseRedirect('/messaging/')
 else:
  form = MailingListForm(user)
 context = _get_default_context(request)
 context.update({'form': form})
 return render_to_response('messaging/mlist_add', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def mlist_add ( request , response_format = 'html' ) : user = request . user . profile if request . POST : mlist = MailingList ( ) form = MailingListForm ( user , request . POST , instance = mlist ) if form . is_valid ( ) : mlist = form . save ( ) mlist . set_user_from_request ( request ) return HttpResponseRedirect ( '/messaging/' ) else : form = MailingListForm ( user ) context = _get_default_context ( request ) context . update ( { 'form' : form } ) return render_to_response ( 'messaging/mlist_add' , context , context_instance = RequestContext ( request ) , response_format = response_format )
new message mlist .