Esempio n. 1
0
def AddActivity(request):
	if request.method == "POST":	
		form = AddActivityForm(request.POST, request.FILES)
		if form.is_valid():
			post = form.save(commit = False)
			post.atorganizer = request.user
			post.save()
			return redirect('philosopher.views.activity.ActivityDetail', activityid = post.id )
	else:
		form = AddActivityForm()
	return render_to_response('templates/philosopher/activityedit.html', {'form' : form},
		context_instance = RequestContext(request) )
Esempio n. 2
0
def EditActivity(request, activityid):
	activity = get_object_or_404(Activity, pk = activityid)
	user = activity.atorganizer
	if request.method == "POST":
		form = AddActivityForm(request.POST, request.FILES, instance=activity)
		if form.is_valid():
			activity = form.save(commit = False)
			activity.atorganizer = user
			activity.save()
			return redirect('philosopher.views.activity.ActivityDetail', activityid = activity.id )		
	else:
		form = AddActivityForm( instance=activity)
	return render_to_response('templates/philosopher/activityedit.html', {'form' : form},
		context_instance = RequestContext(request) )
Esempio n. 3
0
def AddActivity(request):
	if request.method == "POST":	
		form = AddActivityForm(request.POST, request.FILES)
		if form.is_valid():
			post = form.save(commit = False)
			post.atorganizer = request.user
			post.save()
			return redirect('philosopher.views.activity.ActivityDetail', activityid = post.id )
	else:
		form = AddActivityForm()
	return render_to_response('templates/philosopher/activityedit.html', {'form' : form},
		context_instance = RequestContext(request) )
Esempio n. 4
0
def EditActivity(request, activityid):
	activity = get_object_or_404(Activity, pk = activityid)
	user = activity.atorganizer
	if request.method == "POST":
		form = AddActivityForm(request.POST, request.FILES, instance=activity)
		if form.is_valid():
			activity = form.save(commit = False)
			activity.atorganizer = user
			activity.save()
			return redirect('philosopher.views.activity.ActivityDetail', activityid = activity.id )		
	else:
		form = AddActivityForm( instance=activity)
	return render_to_response('templates/philosopher/activityedit.html', {'form' : form},
		context_instance = RequestContext(request) )