@ownership_required
def page_create(request, slug, template_name='groups/pages/page_form.html'):
 group = get_object_or_404(Group, slug=slug)
 form = GroupPageForm(initial={'group': group})
 if (request.method == 'POST'):
  form = GroupPageForm(request.POST)
  if form.is_valid():
   page = form.save(commit=False)
   page.group = group
   page.save()
   return redirect(request, page)
 return render(request, template_name, {'group': group, 'form': form})

@ ownership_required def page_create ( request , slug , template_name = 'groups/pages/page_form.html' ) : group = get_object_or_404 ( Group , slug = slug ) form = GroupPageForm ( initial = { 'group' : group } ) if ( request . method == 'POST' ) : form = GroupPageForm ( request . POST ) if form . is_valid ( ) : page = form . save ( commit = False ) page . group = group page . save ( ) return redirect ( request , page ) return render ( request , template_name , { 'group' : group , 'form' : form } )
creates a group page .