Hi guys, I'm trying to make the below script let users follow each other. Just like adding friends up.So that users will be able to follow each other. When I click the 'follow' button in a user profile, instead of it to take me to the users wall, it will only redirect me to the same page(user profile page). and it won't add up the user.
I just try this code, though. Please put me through. Model: class followme(models.Model): user=models.ForeignKey(User) userprofile=models.ForeignKey(UserProfile) def __unicode__(self): return u"%s" % self.user class FollowForm(ModelForm): class Meta: model=followme exclude=('user','userprofile') View: def followm(request): if request.method=="POST": form=FollowForm(request.POST) if form.is_valid(): new_obj=form.save(commit=False) new_obj.initiated_by=request.user u=User.objects.get(request.POST['profile_id']) new_obj.follow=u new_obj.save() return HttpResponseRedirect('/homi/') else: form=FollowForm() return render_to_rensponse('follow.html', {'FollowForm':form,},context_instance=RequestContext(request)) Template: <html> <body> <form action="" method="POST" > <input type="hidden" name="profile_id" value="{{ profile.id }}" /> <input type='submit' name='follow' value='Follow' /> </form> -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.