could you paste the definition of the models? I think there is the
need of a relationship between 'Data_Siswa' and 'Users'.

regards,
TR


2011/2/22  <delegb...@dudupay.com>:
> I'm not so sure if I'm answering your question but there's a way you can 
> chain querysets.
> In your views.py file import Q from django.db.models.
> You could check django documentation. I think it works well.
> Sent from my BlackBerry wireless device from MTN
>
> -----Original Message-----
> From: Ryan Wijaya <ryankasku...@gmail.com>
> Sender: django-users@googlegroups.com
> Date: Tue, 22 Feb 2011 07:01:49
> To: Django users<django-users@googlegroups.com>
> Reply-To: django-users@googlegroups.com
> Subject: How to merge querysets and sort it?
>
> For me it takes more than a week to solve it alone...
> So to the point, is it possible to merge two querysets and sort it as
> well?
> Recently I've used itertools, but it returns a table with duplicated
> value and requested objects not properly displayed (the get_full_name
> displayed separately with other, creating a new row)
>
>
> here's the codes
> views.py
>
> def view_siswa(request):
>        # list_detail.object_list, {"queryset": Data_Siswa.objects.all(),
> "template_name": "views/view-siswa-list.html"}
>        namasiswa = User.objects.all().exclude(is_staff='false')
>        datasiswa = Data_Siswa.objects.all().order_by('kode_nis')
>        query = chain(datasiswa, namasiswa)
>        variables = RequestContext(request, {'siswa':query,})
>        # variables = RequestContext(request, {'siswa':datasiswa,})
>        return render_to_response(
>                'views/view-siswa-list.html',
>                # { 'siswa':namasiswa, 'datasiswa': datasiswa, }
>                variables,
>        )
>
>
> template
>
> {% for object in siswa %}
>                        <tr>
>                                <td scope="row"class="spec">{{ object.username 
> }}</td>
>                                <td scope="row">{{ object.kode_nis }}</td>
>                                <td scope="row">{{ object.first_name }}</td>
>                                <td scope="row">{{ object.kode_jurusan }}</td>
>                                <td scope="row" width="20px"><a 
> href="/jurnal/siswa/
> {{ object.id }}/">Lihat</a></td>
>                                <td scope="row" width="20px">Edit</td>
>                        </tr>
>                        {% endfor %}
>
>
> Muchly appreciated any help... btw I'm new in Django
>
> Regards
>
> Rian
>
> --
> 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.
>
> --
> 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.
>
>



-- 
--- http://thoreg.org/ ---

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