title: No operator matchesYou might need to add explicit type casts django postgres
body: <p>i was trying to access artist_type based on id when i try domain.com/artist/3 i get this error:</p>
  
  <pre><code>operator does not exist: character varying = integer
  LINE 1: ...main_site_artist" WHERE "main_site_artist"."artist_type" = 3
                                                                  ^
  HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
  </code></pre>
  
  <p>as i can see in table there are 2 artist_type with id 3.
  as i am filtering artist based on artist_type</p>
  
  <p>this is models.py:</p>
  
  <pre><code>from django.db import models
  
  class artist(models.Model):
    CHOICES = (
        (0, 'celebrities'),
        (1, 'singer'),
        (2, 'comedian'),
        (3, 'dancer'),
        (4, 'model'),
        (5, 'Photographer')
    )
    artist_name = models.CharField(max_length = 50)
    artist_type = models.IntegerField(choices = CHOICES)
    description = models.TextField(max_length = 500)
  
    def __str__(self):
      return self.artist_name
  </code></pre>
  
  <p>this is my database table:</p>
  
  <pre><code>celeb=# select * from main_site_artist;
  
  id | artist_name | artist_type |  description   
  ----+-------------+-------------+----------------
  1 | test        | 1           | test
  2 | aka         | 3           | aka
  3 | test2       | 4           | aka
  4 | sonu        | 3           | aka moth
  5 | norma       | 0           | its norma here
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>from django.urls import path
  from . import views
  
  
  
  urlpatterns = [
   path('',views.index, name='mainsite-index'),
   path('about/',views.about, name='mainsite-about'),
   path('contact/', views.contact, name='mainsite-contact'),
   path('artist/&lt;int:artist_type&gt;/',views.talent, name='mainsite-talent'),
   path('book_artist/', views.artist_booking, name="artist_book")
  </code></pre>
  
  <p>]</p>
  
  <p>views.py:</p>
  
  <pre><code> def talent(request, artist_type):
          artists = artist.objects.filter(artist_type = int(artist_type))
          context = {
                   'aka': artists
          }
          return render(request, 'main_site/talent.html', context)
  </code></pre>
  
  <p>this is base.html where i will click :</p>
  
  <pre><code> &lt;ul class="dropdown-menu nav-font" style="margin-top: 7px"&gt;
              &lt;li&gt; &lt;a href={% url 'mainsite-talent' artist_type='0' %} style="color:grey;padding-left:5px"&gt;Celebrities&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt; &lt;a href={% url 'mainsite-talent'  artist_type='1' %} style="color:grey;padding-left:5px"&gt;Singer&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt; &lt;a href={% url 'mainsite-talent' artist_type='2' %} style="color:grey;padding-left:5px"&gt;Comedian&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt; &lt;a href={% url 'mainsite-talent' artist_type='3' %} style="color:grey;padding-left:5px"&gt;Dancer&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt; &lt;a href={% url 'mainsite-talent' artist_type='4' %} style="color:grey;padding-left:5px"&gt;Model&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt; &lt;a href={% url 'mainsite-talent' artist_type='5' %} style="color:grey;padding-left:5px"&gt;Photographer&lt;/a&gt;&lt;/li&gt;
                                   &lt;/ul&gt;
  </code></pre>
  
  <p>now when i access localhost:8000 i get this error:</p>
  
  <pre><code>Reverse for 'mainsite-talent' with no arguments not found. 1 pattern(s) tried: ['artist/(?P&lt;artist_type&gt;[0-9]+)/$']
  </code></pre>
  
  <p>and with localhost:8000/artist/3 still same error:</p>
  
  <pre><code>You might need to add explicit type casts.
  </code></pre>