﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33259	Model._meta.related_objects returns different values in shell and from the request.	Hop Duong	nobody	"I'm implementing caching for the Model and generating the cache key by the Model related objects.

{{{
class CacheModel(models.Model):

    @classmethod
    def get_model_related_fields(cls):
        return cls._meta.related_objects
}}}

I have noticed that this method returns different values when I run from the Django `shell` and from the request. For example:

- From the shell
{{{
(<OneToOneRel: ai_api.leadextradata>, <ManyToOneRel: ai_api.leadsubitv>, <ManyToOneRel: ai_api.attachment>, <ManyToOneRel: ai_api.leadnote>, <ManyToOneRel: ai_api.sharingcandidate>, <OneToOneRel: ai_api.employmentdata>, <OneToOneRel: ai_api.leadshortcodekeyword>, <OneToOneRel: ai_api.leadschedulingsettings>, <OneToOneRel: ai_api.employeeonboarding>, <ManyToOneRel: ai_api.leadschedulemessage>, <OneToOneRel: ai_api.itvteam>, <ManyToOneRel: ai_kb.clienttrainingmessage>, <OneToOneRel: ai_reminders.convoreminderaudit>, <ManyToOneRel: ai_campaign.campaigncontact>, <ManyToOneRel: ai_ratings.ratingconversation>, <ManyToOneRel: ai_ratings.ratingresponse>, <ManyToOneRel: ai_event.eventcandidate>, <ManyToOneRel: ai_event.eventcandidatecheckin>, <OneToOneRel: ai_event.eventitvlead>, <OneToOneRel: ai_event.eventregistration>, <OneToOneRel: ai_event.eventregistrationschedulingsettings>, <ManyToOneRel: ai_journeys.leadjourneyprogress>, <ManyToOneRel: ai_jobs.appliedjob>, <ManyToOneRel: ai_alerts.leadwatcher>, <ManyToOneRel: ai_conversation_flows.leadconvoflow>, <ManyToOneRel: ai_conversation_flows.leadconvostage>, <ManyToOneRel: ai_meeting.meeting>, <ManyToOneRel: ai_interview_prep.itvprepcandidate>, <ManyToOneRel: ai_recorded_interview.recordeditvcandidate>, <ManyToOneRel: ai_candidate_attributes.candidateattributes>, <ManyToOneRel: ai_cms.dynamiccontentcandidate>, <OneToOneRel: ai_candidate_profile.previousapplication>, <ManyToOneRel: ai_candidate_profile.previousapplication>, <ManyToOneRel: ai_conversations.conversationstage>, <ManyToOneRel: ai_conversations.leadsatisfycondition>, <ManyToOneRel: ai_conversations.leadvalidanswer>)
}}}

- From the request
{{{
(<OneToOneRel: ai_api.leadextradata>, <ManyToOneRel: ai_api.leadsubitv>, <ManyToOneRel: ai_api.attachment>, <ManyToOneRel: ai_api.leadnote>, <ManyToOneRel: ai_api.sharingcandidate>, <OneToOneRel: ai_api.employmentdata>, <OneToOneRel: ai_api.leadshortcodekeyword>, <OneToOneRel: ai_api.leadschedulingsettings>, <OneToOneRel: ai_api.employeeonboarding>, <ManyToOneRel: ai_api.leadschedulemessage>, <OneToOneRel: ai_api.itvteam>, <ManyToOneRel: ai_kb.clienttrainingmessage>, <OneToOneRel: ai_reminders.convoreminderaudit>, <ManyToOneRel: ai_campaign.campaigncontact>, <ManyToOneRel: ai_ratings.ratingconversation>, <ManyToOneRel: ai_ratings.ratingresponse>, <ManyToOneRel: ai_event.eventcandidate>, <ManyToOneRel: ai_event.eventcandidatecheckin>, <OneToOneRel: ai_event.eventitvlead>, <OneToOneRel: ai_event.eventregistration>, <OneToOneRel: ai_event.eventregistrationschedulingsettings>, <ManyToOneRel: ai_journeys.leadjourneyprogress>, <ManyToOneRel: ai_jobs.appliedjob>, <ManyToOneRel: ai_alerts.leadwatcher>, <ManyToOneRel: ai_conversation_flows.leadconvoflow>, <ManyToOneRel: ai_conversation_flows.leadconvostage>, <ManyToOneRel: ai_meeting.meeting>, <ManyToOneRel: ai_interview_prep.itvprepcandidate>, <ManyToOneRel: ai_recorded_interview.recordeditvcandidate>, <ManyToOneRel: ai_candidate_attributes.candidateattributes>, <ManyToOneRel: ai_cms.dynamiccontentcandidate>, <OneToOneRel: ai_candidate_profile.previousapplication>, <ManyToOneRel: ai_candidate_profile.previousapplication>, <ManyToOneRel: ai_conversations.conversationstage>, <ManyToOneRel: ai_conversations.leadsatisfycondition>, <ManyToOneRel: ai_conversations.leadvalidanswer>, <ManyToOneRel: ai_cms.intentcmsresponselogs>)
}}}

We have one more model `<ManyToOneRel: ai_cms.intentcmsresponselogs>` in the request."	Bug	closed	Database layer (models, ORM)	3.0	Normal	needsinfo	Model, Related Objects		Unreviewed	0	0	0	0	0	0
