<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Models on KenCochrane.com</title>
    <link>https://www.kencochrane.com/tags/models/</link>
    <description>Recent content in Models on KenCochrane.com</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>Powered by [Hugo](//gohugo.io). Theme by [PPOffice](https://github.com/ppoffice).</copyright>
    <lastBuildDate>Wed, 21 Jan 2009 13:19:00 +0000</lastBuildDate>
    
	<atom:link href="https://www.kencochrane.com/tags/models/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Django Query using value from another field in same table</title>
      <link>https://www.kencochrane.com/blog/2009/01/django-query-using-value-from-another-field-in-same-table/</link>
      <pubDate>Wed, 21 Jan 2009 13:19:00 +0000</pubDate>
      
      <guid>https://www.kencochrane.com/blog/2009/01/django-query-using-value-from-another-field-in-same-table/</guid>
      <description>I came across a query that seemed like it should be pretty easy, but it wasn&amp;rsquo;t.
Suppose you have the following Model Class.
# pseudo code.
class Person(models.Model):
first_name = models.CharField()
last_name = models.CharField()
I would like the query to return all Person&amp;rsquo;s who have the same first_name and last_name
My first guess was to do the following.
person_list = Person.objects.filter(first_name=last_name)
but that doesn&amp;rsquo;t work because it wants to have last_name as a variable.</description>
    </item>
    
  </channel>
</rss>