#NEWLINE# @ membership_required #NEWLINE# def topic_edit( request , slug , topic_id , template_name = 'groups/topics/topic_form.html' ) : #NEWLINE# #INDENT# '\n    Returns a group topic form page.\n\n    Templates: ``groups/topics/topic_form.html``\n    Context:\n        form\n            GroupTopicForm object\n        topic\n            GroupTopic object\n    ' #NEWLINE# group = get_object_or_404 ( Group , slug = slug ) #NEWLINE# topic = get_object_or_404 ( GroupTopic , pk = topic_id , group = group , user = request . user ) #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = GroupTopicForm ( request . POST , instance = topic ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# form . save ( ) #NEWLINE# return redirect ( request , topic ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = GroupTopicForm ( instance = topic ) #NEWLINE# #UNINDENT# return render ( request , template_name , { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# 'group' : group , #NEWLINE# 'topic' : slug , #NEWLINE# #UNINDENT# } )