mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-26 08:53:46 +00:00
Optimisations select_related
This commit is contained in:
parent
0399633cef
commit
f700d59e65
3 changed files with 7 additions and 7 deletions
|
@ -625,21 +625,21 @@ def index(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('cableur')
|
@permission_required('cableur')
|
||||||
def index_iptype(request):
|
def index_iptype(request):
|
||||||
iptype_list = IpType.objects.order_by('type')
|
iptype_list = IpType.objects.select_related('extension').order_by('type')
|
||||||
return render(request, 'machines/index_iptype.html', {'iptype_list':iptype_list})
|
return render(request, 'machines/index_iptype.html', {'iptype_list':iptype_list})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('cableur')
|
@permission_required('cableur')
|
||||||
def index_machinetype(request):
|
def index_machinetype(request):
|
||||||
machinetype_list = MachineType.objects.order_by('type')
|
machinetype_list = MachineType.objects.select_related('ip_type').order_by('type')
|
||||||
return render(request, 'machines/index_machinetype.html', {'machinetype_list':machinetype_list})
|
return render(request, 'machines/index_machinetype.html', {'machinetype_list':machinetype_list})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('cableur')
|
@permission_required('cableur')
|
||||||
def index_extension(request):
|
def index_extension(request):
|
||||||
extension_list = Extension.objects.order_by('name')
|
extension_list = Extension.objects.order_by('name')
|
||||||
mx_list = Mx.objects.order_by('zone')
|
mx_list = Mx.objects.order_by('zone').select_related('zone')
|
||||||
ns_list = Ns.objects.order_by('zone')
|
ns_list = Ns.objects.order_by('zone').select_related('zone')
|
||||||
return render(request, 'machines/index_extension.html', {'extension_list':extension_list, 'mx_list': mx_list, 'ns_list': ns_list})
|
return render(request, 'machines/index_extension.html', {'extension_list':extension_list, 'mx_list': mx_list, 'ns_list': ns_list})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
|
@ -696,7 +696,7 @@ class NewListRightForm(ListRightForm):
|
||||||
self.fields['gid'].label = 'Gid, attention, cet attribut ne doit pas être modifié après création'
|
self.fields['gid'].label = 'Gid, attention, cet attribut ne doit pas être modifié après création'
|
||||||
|
|
||||||
class DelListRightForm(ModelForm):
|
class DelListRightForm(ModelForm):
|
||||||
listrights = forms.ModelMultipleChoiceField(queryset=ListRight.objects.all(), label="Droits actuels", widget=forms.CheckboxSelectMultiple)
|
listrights = forms.ModelMultipleChoiceField(queryset=ListRight.objects.all().select_related('user'), label="Droits actuels", widget=forms.CheckboxSelectMultiple)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
exclude = ['listright','gid']
|
exclude = ['listright','gid']
|
||||||
|
|
|
@ -496,7 +496,7 @@ def index(request):
|
||||||
@permission_required('cableur')
|
@permission_required('cableur')
|
||||||
def index_ban(request):
|
def index_ban(request):
|
||||||
""" Affiche l'ensemble des ban, need droit cableur """
|
""" Affiche l'ensemble des ban, need droit cableur """
|
||||||
ban_list = Ban.objects.order_by('date_start').reverse()
|
ban_list = Ban.objects.order_by('date_start').select_related('user').reverse()
|
||||||
paginator = Paginator(ban_list, PAGINATION_NUMBER)
|
paginator = Paginator(ban_list, PAGINATION_NUMBER)
|
||||||
page = request.GET.get('page')
|
page = request.GET.get('page')
|
||||||
try:
|
try:
|
||||||
|
@ -513,7 +513,7 @@ def index_ban(request):
|
||||||
@permission_required('cableur')
|
@permission_required('cableur')
|
||||||
def index_white(request):
|
def index_white(request):
|
||||||
""" Affiche l'ensemble des whitelist, need droit cableur """
|
""" Affiche l'ensemble des whitelist, need droit cableur """
|
||||||
white_list = Whitelist.objects.order_by('date_start')
|
white_list = Whitelist.objects.select_related('user').order_by('date_start')
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
'users/index_whitelist.html',
|
'users/index_whitelist.html',
|
||||||
|
|
Loading…
Reference in a new issue