On Tue, 8 Sep 2020 at 03:54, Asif Saif Uddin <[email protected]> wrote:
> any help? I can share the full function > I've poked around some of these dark corners, but only since the late 2.x series. After a bit of searching this find-the-field-that-connects-a-model-to-a-through-model <https://stackoverflow.com/questions/52334086/find-the-field-that-connects-a-model-to-a-through-model> and the linked <https://stackoverflow.com/questions/52280584/any-way-to-fetch-the-through-fields-for-an-object-linked-via-many2many-field-wit/52283964#52283964> suggest these are/were private APIs and AFAIK, the best you can do is try to figure out what the old code was doing, and rework them using the likes of: - self._meta.related_objects - self._meta.fields_map - self._meta.local_many_to_man and the other similarly named fields. One thing to note: if a field x points to a *set* of objects, you won't find a "self.x", but rather a "self.x_set" which must be followed using a query such as "self.x_set.all()" rather than a simple field dereference. HTH, Shaheed On Wednesday, August 19, 2020 at 3:42:09 AM UTC+6 [email protected] > wrote: > >> I don't bro i just started new in Django >> >> Victor >> >> On Tue, Aug 18, 2020, 3:46 PM Asif Saif Uddin <[email protected]> wrote: >> >>> >>> Hi, >>> I have got an old project of django 1.8 which use codes like >>> >>> links = [rel.get_accessor_name() for rel in >>> self._meta.get_all_related_objects()] >>> >>> How would I upgrade this code snippets to django 2.2 LTS? >>> >>> TIA >>> >>> -- >>> 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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/c408d424-7c94-43de-beae-4071d424e2ecn%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/c408d424-7c94-43de-beae-4071d424e2ecn%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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/e83b7021-3158-41b2-b48f-33d9f45270a6n%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/e83b7021-3158-41b2-b48f-33d9f45270a6n%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHAc2jfeKWgiD97bYYePPAv0zMm2zKXqnirLsM5fUm%3DEC2xRfA%40mail.gmail.com.

