Created
May 23, 2021 13:26
-
-
Save rupython/0fc7fdace8187bb86bd754d7cfc6b72e to your computer and use it in GitHub Desktop.
From: Sorin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Привет, есть 3 модельки, как сформировать запрос чтобы выбести все LocationCompany с определеном city или sector, + DomainService domain + Service service_type, name | |
class Service(models.Model): | |
name = models.CharField(max_length=20, blank=True, null=True) | |
service_type = models.ForeignKey(Service_type, on_delete=models.CASCADE) | |
price = models.DecimalField(max_digits=10, decimal_places=0) | |
slug = models.SlugField(max_length=30) | |
class DomainService(models.Model): | |
domain = models.CharField(max_length=30) | |
sercices = models.ManyToManyField(Service, blank=True) | |
title = models.CharField(max_length=200, blank=True) | |
short_description = models.CharField(max_length=500, blank=True) | |
long_description = models.CharField(max_length=1000, blank=True) | |
specialization = models.ForeignKey(SpecializationService, on_delete=models.SET_NULL, blank=True, null=True) | |
slug = models.SlugField(max_length=30) | |
class LocationCompany(models.Model): | |
company = models.ForeignKey(MyUser, on_delete=models.CASCADE, blank=True, null=True) | |
doctors = models.ManyToManyField(MyUser, blank=True, related_name='company_doctors') | |
domain = models.ManyToManyField(DomainService, blank=True) | |
city = models.CharField(max_length=30) | |
sector = models.CharField(max_length=30, blank=True, null=True) | |
street = models.CharField(max_length=30, blank=True, null=True) | |
google_maps_link = models.CharField(max_length=500, blank=True, null=True) | |
slug = models.SlugField(max_length=30) | |
slug_sector = models.SlugField(max_length=30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment