models.py
class Regions(models.Model): 
 region_name = models.CharField(max_length=255) 

  class Locations(models.Model): region = models.ForeignKey(Regions, 
on_delete=models.CASCADE,blank=True,null=True) name = 
models.CharField(max_length=255) 


How to do this query in django?
select locations.name,regions.region_name from locations inner join regions 
on locations.region_id = regions.id order by locations.name; 

I want to show in select tag like country-city

-- 
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/29b954e2-646d-4b58-ba0d-381660ba2f33n%40googlegroups.com.

Reply via email to