title: null value in column "logo_url" violates not-null constraint in django
body: <p>I am trying to make an app that searches the logo of a website and gets the link of the image. Unfortunately, it gives me this error on some sites like "reddit.com" and the code is working fine on sites like "crossfitcut.com".
  Why is the problem appearing and how can I eliminate it?</p>
  
  <p>This is the code for the logo searcher: </p>
  
  <pre><code>BAD_WEBSITE = 'bad_website'
  
  # if I eliminate this function the compiler doesn't give me an error
  def validate_url(value):
      url_validator = URLValidator()
      value_1_invalid = False
      value_2_invalid = False
      try:
          url_validator(value)
      except:
          value_1_invalid = True
  
      if not value_1_invalid:
          return value
  
      value_2_url = "http://" + value
  
      try:
          url_validator(value_2_url)
      except:
          value_2_invalid = True
  
      if value_1_invalid and value_2_invalid:
          raise ValidationError("Invalid URL")
  
      return value_2_url
  
  def get_logo(url):
      website = validate_url(url)
      try:
          result = requests.get(website, headers={
              'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
          }, timeout=30)
      except:
          return BAD_WEBSITE
      if result.status_code == 200:
          soup = BeautifulSoup(result.content, 'html.parser')
          logo = None
          try:
              for item in soup.select(re.compile('.*logo.*')):
                  if item.name == 'img':
                      return item['src']
                  else:
                      return item.find('img')['src']
  
          except:
              pass
          if not logo:
              stripped = website.strip('/')
              homes = ['/', 'index.php', 'index.html', 'home.html']
              urls = [website]
              for home in homes:
                  urls.append(stripped + '/' + home.strip('/'))
                  urls.append(home)
                  urls.append('/' + home)
  
              for item in soup.find_all('a', href=True):
                  if item['href'] in urls:
                      try:
                          return item.find('img')['src']
                      except:
                          pass
  
          if not logo:
              try:
                  for item in soup.find_all('img'):
                      if 'logo' in str(item):
                          return item['src']
              except:
                  pass
          return None
      else:
          return BAD_WEBSITE
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>class HomeView(View):
      def get(self, request):
          the_form = SubmitUrlForm()
          context = {
              "title": "Find Logo",
              "form": the_form
          }
          return render(request, 'home.html', context)
  
      def post(self, request):
          form = SubmitUrlForm(request.POST)
          context = {
              "title": "Find Logo",
              "form": form
          }
          template = 'home.html'
          if form.is_valid():
              new_url = form.cleaned_data.get('url')
              true_url = clean_url(new_url)
  
              get_logo_url = get_logo(true_url)
              true_tld = tld_of_url(true_url)
  
              obj, created = FindLogo.objects.get_or_create(url=true_url,logo_url=get_logo_url,tld=true_tld)
              context = {
                  "object": obj,
                  "created": created,
              }
              if created:
                  template = 'success.html'
              else:
                  template = 'exists.html'
  
          return render(request, template, context)
  
  class LogoRedirectView(View):
      def get(self, request):
          obj = get_object_or_404(FindLogo)
          return HttpResponseRedirect(obj.url)
  </code></pre>
  
  <p>HTML file:</p>
  
  <pre><code>&lt;div style=" align-text: center; width: 800px; margin: 0 auto;"&gt;
      &lt;h1&gt;Added to database&lt;/h1&gt;
      &lt;h2&gt;Search Logo Function&lt;/h2&gt;
      &lt;img src="{{ object.logo_url }}"&gt;
      &lt;br/&gt;
      &lt;br/&gt;
      &lt;form action="."&gt; {% csrf_token %}
          &lt;input type="submit" value="Find another Logo"&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>