Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8034177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:55:43+00:00 2026-06-05T01:55:43+00:00

I am making an Ajax request into views as follows: def all_json_models(request): data =

  • 0

I am making an Ajax request into views as follows:

def all_json_models(request):
    data = {}
    try:

    isp = request.GET['status']
    present_isp =  Priority.objects.filter(ispname = isp)
    isp_count = MultiWAN.objects.all()

  #  data['latest_no_rules']  =   latest_no_rules
    #data['present_isp']  = present_isp
    data['isp_count'] = isp_count

    return HttpResponse(simplejson.dumps(data))   

my models.py is like

class MultiWAN(models.Model):

    isp_name = models.CharField(max_length=10)
    description  = models.TextField(null=True)
    ip_address   = models.IPAddressField(null=True)
    subnet       = models.IPAddressField(null=True)
    gateway      = models.IPAddressField(null=True)
    nameserver   = models.ForeignKey('NameServer')
    weight       = models.IntegerField(null=False)
    interface    = models.CharField(max_length=5) 
    def __unicode__(self):
        """
        This function is to return the values we required.
        Arguments:
        - `self`:
        """
      #  return u'%s ' % (self.isp_name)


class NameServer(models.Model):
    """  A Isp can have more than one nameserver so far we are declearing a seperate table 
    """         
    name = models.IPAddressField(null=False)    




class Priority(models.Model):  
    priority =  models.IntegerField(null = True)
    ispname = models.ForeignKey('MultiWAN')
    rule = models.CharField(max_length=5,null=False)
    From  =    models.IPAddressField(null=True)
    To = models.IPAddressField(null=True)
    def __unicode__(self):
                      return u'%s ' % (self.priority)

while making request i am getting the error:

"coercing to Unicode: need string or buffer, NoneType found"

What i am doing wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:55:45+00:00Added an answer on June 5, 2026 at 1:55 am

    It’s hard to tell without the full traceback (because it gives information about where in you code the exception is thrown).

    The error message “coercing to Unicode: need string or buffer, NoneType found” means that, at some point, django tried to convert something to unicode and expected a string, but received None. This means that either you call a function passing None instead of a string, or one of you methods returns None instead of a string.

    In the code you showed us, MultiWAN.__unicode__ seems ill-defined. Maybe the error stems from this ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my page I'm making ajax-request to get data from server. The data is
I am making an ajax request using JQuery that looks like this: var data
i am making a ajax request using $.get as soon as the user types
I am making an ajax request from a jquery script to one of my
I am making an ajax request to my servlet and the servelt responds with
So I'm making an Ajax request in a Rails app and I hava a
I am making an ajax request to a file and as part of the
I'm making a jQuery Ajax POST request to a PHP script that returns an
i am making ajax calls with jquery like this http://pastie.org/860837 and sometimes i get
I'm making an AJAX request and sending along some JSON: $(function() { var json

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.