Hi,

try self.submitter.id

Radovan

On May 4, 10:58 pm, Ján Vorčák <vorcak....@gmail.com> wrote:
> Hi,
>
> I'd like to ask you for some help :)
>
> I have a model with one foreign key
>
> ....
> from django.contrib.auth.models import User
> ....
>
> class Task(models.Model):
>     ...
>     submitter = models.ForeignKey(User, related_name='submitter')
>     ...
>
>     def get_user_link(self):
>         return "<a href=\"/tasks/view/%(id)s\">%(name)s</a>" %
> { 'id' : ???, 'name' : self.submitter }
>
>     get_user_link.allow_tags = True
>
> And I user get_user_link to display link to user profile from
> administration,
> I just don't know how can I access attribute of the ForeignKey value,
> for instance id of user (submitter) in order to display it's url
>
> Thank you for your time

-- 
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.

Reply via email to