Re: sort by alphabet

2022-04-11 Thread Antonis Christofides
Please read the documentation of order_by(). It tells you how you can do this. On 11/04/2022 20.15, divya murugulla wrote: that is not working since my sort function is of different table On Monday, April 11, 2022 at 10:44:14 PM UTC+5:30 Antonis Christofides wrote: Same thing, use Co

Re: sort by alphabet

2022-04-11 Thread divya murugulla
that is not working since my sort function is of different table On Monday, April 11, 2022 at 10:44:14 PM UTC+5:30 Antonis Christofides wrote: > Same thing, use > CommodityLocatinoXref.objects.select_related(...).filter(...).order_by(...) > > > On 11/04/2022 20.03, divya murugulla wrote: > > la

Re: sort by alphabet

2022-04-11 Thread Antonis Christofides
Same thing, use CommodityLocatinoXref.objects.select_related(...).filter(...).order_by(...) On 11/04/2022 20.03, divya murugulla wrote: latamSupplyPoints = [ (e.globe_code_id, e.globe_code.plant_name) for e in CommodityLocationXref.objects.select_related('globe_code','cmdty_loc').filter(cmdt

Re: sort by alphabet

2022-04-11 Thread divya murugulla
latamSupplyPoints = [ (e.globe_code_id, e.globe_code.plant_name) for e in CommodityLocationXref.objects.select_related('globe_code','cmdty_loc').filter(cmdty_loc_id__in=LatamLocationIds) ] how to sort these values On Monday, April 11, 2022 at 10:00:50 PM UTC+5:30 Antonis Christofides wrote:

Re: sort by alphabet

2022-04-11 Thread Antonis Christofides
Hi, You need to replace queryset=GlobePlant.objects.all() with queryset=GlobePlant.objects.all().order_by(...) I can't tell you what arguments to give "order_by()" without seeing your GlobePlant model, but if you read Django's documentation for order_by you should be able to determine that.

sort by alphabet

2022-04-11 Thread divya murugulla
Please help me sort the queryset by name alphabetical order. plant = forms.ModelChoiceField(label='Destinations Name',queryset=GlobePlant.objects.all(),empty_label='Select the Point',required=True) Thanks & Regards, Divya -- You received this message because you are subscribed to the