Solved it by doing this: def profile_detail(request, name): p = get_object_or_404(Profile, name=name) return render_to_response('profile_detail.html', {'name': p})
On 1 Aug, 12:22, "Rob B (uk)" <robtot...@googlemail.com> wrote: > Using the url to look up a user profile just not sure what to put in > the view. Any suggestions welcome. > > Model: > class Profile(models.Model): > title = models.ForeignKey(User, unique=True) > name = models.CharField(max_length=50, null=False, blank=False) > > def __unicode__(self): > return self.name > > URL: > (r'^(?P<name>[\w\._-]+)/$', 'mysite.profiles.views.profile_detail'), > > View: > def profile_detail(request, name): > name = get_list_or_404(Profile, name=name) > return render_to_response('profile_detail.html', .... now what? > > Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---