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.

Regards,

Antonis


On 11/04/2022 18.47, divya murugulla wrote:

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 Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/56143c58-7525-4cab-959b-acf79b50a7dbn%40googlegroups.com <https://groups.google.com/d/msgid/django-users/56143c58-7525-4cab-959b-acf79b50a7dbn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7f79a9ca-6457-3500-6182-943048078ad5%40antonischristofides.com.

Reply via email to