def club_update( request, *args, **kwargs ):

	if not PermissionHandler.edit_club( request.user, club = kwargs['club'] ):
		return PermissionDenied('You are not allowed to edit!')

	club = get_object_or_404( Club, pk = kwargs['club'] )

	try:
		club.description = request.POST['description']
		club.name = request.POST['name']
		club.image = request.FILES['image']
		club.save()
	except ValueError as e:	# implement a form clean mechanism here.
		raise PermissionDenied('Error')

	return redirect( reverse('project:club_detail', args=[kwargs['club']] ) )
def club_detail_view( request, **kwargs ):

	ctx = { }

	ctx['club'] = get_object_or_404( Club, pk = kwargs['club'] )
	ctx['project_list'] = Project.objects.filter( club = ctx['club'] )

	if not PermissionHandler.edit_club( request.user, club = kwargs['club'] ):
		ctx['allow_club_edit'] = 0
	else:
		ctx['allow_club_edit'] = 1

	if not PermissionHandler.create_project( request.user, club = kwargs['club'] ):
		ctx['allow_project_create'] = 0
	else:
		ctx['allow_project_create'] = 1

	if not PermissionHandler.add_core_to_club( request.user, club = kwargs['club'] ):
		ctx['allow_add_core'] = 0
	else:
		ctx['allow_add_core'] = 1
		
	return render_to_response( 'project/club_details.html', ctx, context_instance = RequestContext(request) )