you didn't show me a model structure, you just showed another model, so I can't give you example without picture of what's going on there
On Monday, August 7, 2017 at 1:39:49 PM UTC+3, Arun S wrote: > > Can you just give an Example for this taking a Query. > > > > On Monday, August 7, 2017 at 3:37:04 PM UTC+5:30, lemme smash wrote: >> >> i meant EvalState model >> if name attribute on it is a ForeignKey you should get corresponding >> queryset of model it links to >> if it's charfield, you should use text choices >> >> On Monday, August 7, 2017 at 6:22:50 AM UTC+3, Arun S wrote: >>> >>> The Models Look like this : >>> >>> stage_state = models.ForeignKey(EvalState, verbose_name="Eval State") >>> class Bundle(AtlasAuditModel, AtlasBaseHelper):^M >>> """^M >>> Represents the bundle purchased by the customer. The bundle^M >>> contains a reference identifier which remains the same if the^M >>> the bundle is either upgraded or entended.^M >>> A bundle can have 0 or more features.^M >>> """^M >>> bundle_id = models.CharField(verbose_name="Bundle ID",^M >>> max_length=32,^M >>> unique=True)^M >>> .... >>> .... >>> .... >>> stage_state = models.ForeignKey(*EvalState*, verbose_name="Eval >>> State") >>> >>> >>> atlas_bundle; >>> atlas_bundle | CREATE TABLE `atlas_bundle` ( >>> `id` int(11) NOT NULL AUTO_INCREMENT, >>> ... >>> .... >>> ... >>> *`stage_state_id` int(11) NOT NULL,* >>> PRIMARY KEY (`id`), >>> *KEY `atlas_bundle_36c1765e` (`stage_state_id`)* >>> ) ENGINE=InnoDB AUTO_INCREMENT=1408 DEFAULT CHARSET=latin1 >>> ROW_FORMAT=DYNAMIC | >>> 19 rows in set (0.01 sec) >>> >>> desc *evalstate*; >>> +---------------+--------------+------+-----+---------+----------------+ >>> | Field | Type | Null | Key | Default | Extra | >>> +---------------+--------------+------+-----+---------+----------------+ >>> | id | int(11) | NO | PRI | NULL | auto_increment | >>> | name | varchar(32) | NO | UNI | NULL | | >>> | friendly_name | varchar(32) | NO | UNI | NULL | | >>> | description | varchar(255) | YES | | NULL | | >>> +---------------+--------------+------+-----+---------+----------------+ >>> 4 rows in set (0.00 sec) >>> >>> Whats the Difference in having qs when there is a foriegn Key value? >>> >>> Arun >>> >>> On Sunday, August 6, 2017 at 7:48:11 PM UTC+5:30, lemme smash wrote: >>>> >>>> so, you can maybe show you models structure here? >>>> also, if it is a ForeignKey, why you trying to filter qs by string >>>> values? I mean Q(name = 'ACTIVE') >>>> it's shouldn't work >>>> >>>> >>>> On Sunday, August 6, 2017 at 5:22:21 AM UTC+3, Arun S wrote: >>>>> >>>>> Yes, name is a foreign key here. >>>> >>>> -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f0016136-3478-4af3-8509-28b964397090%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

