Re: Foreignkey / Relationship / Views

2007-12-15 Thread Empty
I'm not sure where you are getting the "u" from. It should be user, such as: AppointmentParticipant.objects.filter(participant_user__pk=user.id).select_related() You don't really need the depth in this case, unless you have more to your models I'm not seeing. The rest of it looks fine. Michae

Re: Foreignkey / Relationship / Views

2007-12-15 Thread [EMAIL PROTECTED]
Hello, Thanks for your answers which helped me a lot. Finally my models.py looks like: def appointments_all(request): user = request.user appointments = AppointmentParticipant.objects.filter(participant_user__pk=u.id).select_related(depth=2) return render_to_response('ap

Re: Foreignkey / Relationship / Views

2007-12-14 Thread James Bennett
On Dec 14, 2007 2:08 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > My problem is how to retrieve all appointment details in a view for > the current user, suppose he has got the user_id = 1. Appointment.objects.filter(appointmentparticipant__participant_user__pk=request.user.id) -- "Burea

Re: Foreignkey / Relationship / Views

2007-12-14 Thread Karen Tracey
On 12/14/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > > Hello, > > I'm rather new to Django and I've got a problem with foreign keys and > relationships in the views.py. > > Suppose I would like to create a calendar application with multiple > users. There should be the possibility that mu

Foreignkey / Relationship / Views

2007-12-14 Thread [EMAIL PROTECTED]
Hello, I'm rather new to Django and I've got a problem with foreign keys and relationships in the views.py. Suppose I would like to create a calendar application with multiple users. There should be the possibility that multiple users are participant of one appointment. That is the correspondin