M
M
Meekey2018-08-29 14:55:33
Django
Meekey, 2018-08-29 14:55:33

How to perform a call from the field of an object to the fields of several other objects?

I have a question. How to access from the start_point and end_point of the Pipeline model to 3 objects (Factory, OilSump, OilStorage) to the address fields

class Factory(models.Model):
    title = models.CharField(max_length=200)
    address = YmapCoord(max_length=200, start_query=u'Россия', size_width=500, size_height=500, unique = True)

    def __str__(self):
        return self.title



class OilSump(models.Model):
    title = models.CharField(max_length=200)
    address = YmapCoord(max_length=200, start_query=u'Россия', size_width=500, size_height=500, unique = True)

    def __str__(self):
        return self.title


class OilStorage(models.Model):
    title = models.CharField(max_length=200)
    address = YmapCoord(max_length=200, start_query=u'Россия', size_width=500, size_height=500, unique = True)

    def __str__(self):
        return self.title


class Pipeline(models.Model):
    title = models.CharField(max_length=200)
    start_point = ????
    end_point = ????

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Acheron, 2018-08-29
@Acheron

Maybe this will help:
https://docs.djangoproject.com/en/2.1/ref/models/f...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question