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 7634287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:07:52+00:00 2026-05-31T07:07:52+00:00

I have a function in views.py def get_interview_type(request): i = None title = request.GET[‘title’]

  • 0
I have a function in views.py

    def get_interview_type(request):
        i = None
        title = request.GET['title'] #Here the title becomes different
        try:
            i = Interview.objects.get(title=title) #it looks for that dropdown value
            #Error according to pdb
            #-> i = Interview.objects.get(title=title)
            #    (Pdb) 
            #    DoesNotExist: DoesNotE...exist.',)

            if i.interview_type == "Time Series":
                visit_ids = i.visit_set.all()
                reference_visit_list = [] 
                for visit in visit_ids:
                    reference_visit_list.append(visit.reference_visit)
                reference_visit_list.extend(visit_ids)
                list(set(reference_visit_list))
                len_visits=filter(None,reference_visit_list)
                total_visits = len(len_visits)
                return render_to_response('export/get_details.html',
                                      {'visits':visit_ids,'count':visit_ids.count(),
                                       'total_visits':total_visits},
                                       context_instance=RequestContext(request)
                                      )
            else:
                return render_to_response('export/get_interview_type.html',
                                      {'visits':i.visit_set.all()},
                                       context_instance=RequestContext(request)
                                    )
        except Interview.DoesNotExist:
            pass

When the user selects a title from the dropdown this function is called and does it tasks.
Now i have entered a string which include ‘&’ ampersand thinking that it can play a role of ‘and’ in normal english like this :-

‘CI-2-UGI & Bowel Symptom Screening & Characterization'(It is one of that dropdown value)
Now when user selects this value from dropdown the title does not remain the same, instead the title changes to CI-2-UGI(in title = request.GET[‘title’]) and before the function executes i recieve a 500 error page.
This is what the error prints in runserver mode

/home/user/cpms/careprep/tags/4.0/careprep/export/views.py(66)get_interview_type()->None
-> pass
(Pdb) c
[11/Mar/2012 22:05:20] “GET /export/get_interview_type/?title=CI-2-UGI%20&%20Bowel%20Symptom%20Screening%20&%20Characterization HTTP/1.1” 500 64490

Also when i remove that ‘&’ampersand from the title there is no 500 page.
Why this & causing the problem ? I think in this way every special symbol will cause the same problem .I will appreciate if anybody can guide me on this and how to solve this problem

  • 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-05-31T07:07:53+00:00Added an answer on May 31, 2026 at 7:07 am

    Because & is used to separate fields in the query string. URL-encode it first.

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

Sidebar

Related Questions

I have the following view function in activities.views : def activity_thumbnail(request, id): pass I'm
I have written a function having the following signature: def action_handler(request, model): This action_handler
Assuming that I have function get_a_color in a Django views.py: from django.utils import simplejson
In one of my views I'm saving a few sessions like this: def myview(request):
So I have 2 views: the first one generates the html on request, the
In my views.py, i have a snippit of code like this: def clean_post_data(form): for
The following in part of my view file def user_detail(request, username, template_name='auth/user_detail.html', extra_context=None): context
I have the view function in django that written like a dispatcher calling other
I have a function in a view that renders the xml in the browser,
I have coded a view that relies on a scalar function value for one

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.