Thursday, October 6, 2011

Class Views

I have the following class defined

class TeamView(TemplateResponseMixin, View):
template_name = 'team.html'

def get(self, request):
if 'team' in request.GET:
team = Team.objects.get(id = request.GET['team'])
form = TeamForm( )
else:
team = None
form = TeamForm()

return self.render_to_response({'form':form, 'team':team})

def post(self, request):
form = TeamForm(request.POST)

if not form.is_valid():
return self.render_to_reponse({'form': form})
...

When I call the self.render_to_response in the get it works fine, but
when I call it in the post
I get 'TeamView' object has no attribute 'render_to_reponse'

Any suggestions what I am doing wrong?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment