how to take result from 2 models

21 views
Skip to first unread message

sotiris moustogiannis

unread,
Oct 13, 2019, 6:39:43 PM10/13/19
to Django users
i have 2 models that Appointments.shopid is foreign key from Shops.id model

class Shops(models.Model):
name = CharField(max_length=50)
username = CharField(max_length=60)
shopname = CharField(max_length=50)
city = CharField(max_length=50)
area = CharField(max_length=50, blank=True, null=True)
typesport = CharField(max_length=40)

def __str__(self):
return f'{self.name} Shops'
 

class Appointments(models.Model):
shopid = models.ForeignKey(Shops, on_delete=models.CASCADE)
date = models.DateField(auto_now=False, auto_now_add=False,blank=True)
time = models.TimeField(auto_now=False, auto_now_add=False,blank=True)

def __str__(self):
return f'{self.id} Appointments'


and  i want to show shops with  given date dynamically

Suraj Thapa FC

unread,
Oct 13, 2019, 11:32:51 PM10/13/19
to django...@googlegroups.com
Use ajax


--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8d8b6e58-b283-465b-834a-7b9a9692d4a2%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages